| 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 | } |
nothing calls this directly
no test coverage detected