| 88 | } |
| 89 | |
| 90 | Future<slave::Containerizer::LaunchResult> launch( |
| 91 | const ContainerID& containerId, |
| 92 | const ContainerConfig& containerConfig, |
| 93 | const map<string, string>& environment, |
| 94 | const Option<string>& pidCheckpointPath) |
| 95 | { |
| 96 | CHECK(!terminatedContainers.contains(containerId)) |
| 97 | << "Failed to launch nested container " << containerId |
| 98 | << " for executor '" << containerConfig.executor_info().executor_id() |
| 99 | << "' of framework " << containerConfig.executor_info().framework_id() |
| 100 | << " because this ContainerID is being re-used with" |
| 101 | << " a previously terminated container"; |
| 102 | |
| 103 | CHECK(!containers_.contains(containerId)) |
| 104 | << "Failed to launch container " << containerId |
| 105 | << " for executor '" << containerConfig.executor_info().executor_id() |
| 106 | << "' of framework " << containerConfig.executor_info().framework_id() |
| 107 | << " because it is already launched"; |
| 108 | |
| 109 | containers_[containerId] = Owned<ContainerData>(new ContainerData()); |
| 110 | |
| 111 | if (containerId.has_parent()) { |
| 112 | // Launching a nested container via the test containerizer is a |
| 113 | // no-op for now. |
| 114 | return slave::Containerizer::LaunchResult::SUCCESS; |
| 115 | } |
| 116 | |
| 117 | CHECK(executors.contains(containerConfig.executor_info().executor_id())) |
| 118 | << "Failed to launch executor '" |
| 119 | << containerConfig.executor_info().executor_id() |
| 120 | << "' of framework " << containerConfig.executor_info().framework_id() |
| 121 | << " because it is unknown to the containerizer"; |
| 122 | |
| 123 | containers_.at(containerId)->executorId = |
| 124 | containerConfig.executor_info().executor_id(); |
| 125 | |
| 126 | containers_.at(containerId)->frameworkId = |
| 127 | containerConfig.executor_info().framework_id(); |
| 128 | |
| 129 | // Assemble the environment for the executor. |
| 130 | // |
| 131 | // NOTE: Since in this case the executor will live in the same OS process, |
| 132 | // pass the environment into the executor driver (library) c-tor directly |
| 133 | // instead of manipulating `setenv`/`getenv` to avoid concurrent |
| 134 | // modification of the environment. |
| 135 | map<string, string> fullEnvironment = os::environment(); |
| 136 | |
| 137 | fullEnvironment.insert(environment.begin(), environment.end()); |
| 138 | |
| 139 | // TODO(benh): Can this be removed and done exclusively in the |
| 140 | // 'executorEnvironment()' function? There are other places in the |
| 141 | // code where we do this as well and it's likely we can do this once |
| 142 | // in 'executorEnvironment()'. |
| 143 | foreach (const Environment::Variable& variable, |
| 144 | containerConfig.executor_info() |
| 145 | .command().environment().variables()) { |
| 146 | fullEnvironment.emplace(variable.name(), variable.value()); |
| 147 | } |
no test coverage detected