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

Method detachTaskVolumeDirectories

src/slave/slave.cpp:1346–1438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1344
1345
1346void Slave::detachTaskVolumeDirectories(
1347 const ExecutorInfo& executorInfo,
1348 const ContainerID& executorContainerId,
1349 const vector<Task>& tasks)
1350{
1351 // NOTE: If the executor is not a default executor, this function will
1352 // still be called but with an empty list of tasks.
1353 CHECK(tasks.empty() ||
1354 (executorInfo.has_type() &&
1355 executorInfo.type() == ExecutorInfo::DEFAULT));
1356
1357 hashset<string> executorContainerPaths;
1358 foreach (const Resource& resource, executorInfo.resources()) {
1359 // Ignore if there are no disk resources or if the
1360 // disk resources did not specify a volume mapping.
1361 if (!resource.has_disk() || !resource.disk().has_volume()) {
1362 continue;
1363 }
1364
1365 const Volume& volume = resource.disk().volume();
1366 executorContainerPaths.insert(volume.container_path());
1367 }
1368
1369 foreach (const Task& task, tasks) {
1370 CHECK_EQ(task.executor_id(), executorInfo.executor_id());
1371
1372 // This is the case that the task has disk resources specified.
1373 foreach (const Resource& resource, task.resources()) {
1374 // Ignore if there are no disk resources or if the
1375 // disk resources did not specify a volume mapping.
1376 if (!resource.has_disk() || !resource.disk().has_volume()) {
1377 continue;
1378 }
1379
1380 const Volume& volume = resource.disk().volume();
1381
1382 const string taskPath = paths::getTaskPath(
1383 flags.work_dir,
1384 info.id(),
1385 task.framework_id(),
1386 task.executor_id(),
1387 executorContainerId,
1388 task.task_id());
1389
1390 const string taskDirectoryPath =
1391 path::join(taskPath, volume.container_path());
1392
1393 files->detach(taskDirectoryPath);
1394 }
1395
1396 if (executorContainerPaths.empty()) {
1397 continue;
1398 }
1399
1400 // This is the case that the executor has disk resources specified
1401 // and the task's ContainerInfo has a `SANDBOX_PATH` volume with type
1402 // `PARENT` to share the executor's disk volume.
1403 if (task.has_container()) {

Callers 1

completeTaskMethod · 0.80

Calls 2

typeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected