MCPcopy Create free account
hub / github.com/apache/mesos / foreach

Method foreach

src/launcher/default_executor.cpp:447–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445 vector<Future<Response>> responses;
446
447 foreach (const TaskInfo& task, taskGroup.tasks()) {
448 ContainerID containerId;
449 containerId.set_value(id::UUID::random().toString());
450 containerId.mutable_parent()->CopyFrom(executorContainerId.get());
451
452 containerIds.push_back(containerId);
453
454 containers[task.task_id()] = Owned<Container>(new Container{
455 containerId,
456 task,
457 taskGroup,
458 None(),
459 None(),
460 None(),
461 None(),
462 None(),
463 false,
464 false,
465 false,
466 false});
467
468 // Send out the initial TASK_STARTING update.
469 const TaskStatus status = createTaskStatus(task.task_id(), TASK_STARTING);
470 forward(status);
471
472 agent::Call call;
473 call.set_type(agent::Call::LAUNCH_CONTAINER);
474
475 agent::Call::LaunchContainer* launch = call.mutable_launch_container();
476 launch->mutable_container_id()->CopyFrom(containerId);
477
478 if (task.has_command()) {
479 launch->mutable_command()->CopyFrom(task.command());
480 }
481
482 if (task.has_container()) {
483 launch->mutable_container()->CopyFrom(task.container());
484 }
485
486 launch->mutable_resources()->CopyFrom(task.resources());
487
488 if (!task.limits().empty()) {
489 *launch->mutable_limits() = task.limits();
490 }
491
492 // Currently any disk resources used by the task are mounted
493 // on the top level container. As a workaround, we set up the
494 // volume mapping allowing child containers to share the volumes
495 // from their parent containers sandbox.
496 //
497 // TODO(qianzhang): Mount the disk resources on the task containers
498 // directly and then remove this workaround.
499 foreach (const Resource& resource, task.resources()) {
500 // Ignore if there are no disk resources or if the
501 // disk resources did not specify a volume mapping.
502 if (!resource.has_disk() || !resource.disk().has_volume()) {
503 continue;
504 }

Callers

nothing calls this directly

Calls 15

randomFunction · 0.85
NoneClass · 0.85
createTaskStatusFunction · 0.85
deferFunction · 0.85
NanosecondsClass · 0.85
CopyFromMethod · 0.80
commandMethod · 0.80
GetMethod · 0.80
atMethod · 0.80
errorMethod · 0.65
postFunction · 0.50
createFunction · 0.50

Tested by

no test coverage detected