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

Method _launch

src/slave/containerizer/docker.cpp:1261–1353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1259
1260
1261Future<Containerizer::LaunchResult> DockerContainerizerProcess::_launch(
1262 const ContainerID& containerId,
1263 const ContainerConfig& containerConfig)
1264{
1265 if (!containers_.contains(containerId)) {
1266 return Failure("Container is already destroyed");
1267 }
1268
1269 Container* container = containers_.at(containerId);
1270
1271 if (containerConfig.has_task_info() && flags.docker_mesos_image.isNone()) {
1272 // Launching task by forking a subprocess to run docker executor.
1273 // TODO(steveniemitz): We should call 'update' to set CPU/CFS/mem
1274 // quotas after 'launchExecutorProcess'. However, there is a race
1275 // where 'update' can be called before mesos-docker-executor
1276 // creates the Docker container for the task. See more details in
1277 // the comments of r33174.
1278 return container->launch = fetch(containerId)
1279 .then(defer(self(), [=]() {
1280 return pull(containerId);
1281 }))
1282 .then(defer(self(), [=]() {
1283 if (HookManager::hooksAvailable()) {
1284 HookManager::slavePostFetchHook(
1285 containerId, containerConfig.directory());
1286 }
1287
1288 return mountPersistentVolumes(containerId);
1289 }))
1290 .then(defer(self(), [=]() {
1291 return launchExecutorProcess(containerId);
1292 }))
1293 .then(defer(self(), [=](pid_t pid) {
1294 return reapExecutor(containerId, pid);
1295 }))
1296 .then([]() {
1297 return Containerizer::LaunchResult::SUCCESS;
1298 });
1299 }
1300
1301 string containerName = container->containerName;
1302
1303 if (container->executorName().isSome()) {
1304 // Launch the container with the executor name as we expect the
1305 // executor will launch the docker container.
1306 containerName = container->executorName().get();
1307 }
1308
1309 // Launching task or executor by launching a separate docker
1310 // container to run the executor.
1311 // We need to do so for launching a task because as the slave is
1312 // running in a container (via docker_mesos_image flag) we want the
1313 // executor to keep running when the slave container dies.
1314 return container->launch = fetch(containerId)
1315 .then(defer(self(), [=]() {
1316 return pull(containerId);
1317 }))
1318 .then(defer(self(), [=]() {

Callers

nothing calls this directly

Calls 12

FailureClass · 0.85
deferFunction · 0.85
atMethod · 0.80
executorNameMethod · 0.80
fetchFunction · 0.50
updateFunction · 0.50
containsMethod · 0.45
isNoneMethod · 0.45
thenMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45
resourcesMethod · 0.45

Tested by

no test coverage detected