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

Method finished

src/linux/cgroups.cpp:1494–1529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1492 }
1493
1494 void finished(const Future<vector<Option<int>>>& future)
1495 {
1496 if (future.isDiscarded()) {
1497 promise.fail("Unexpected discard of future");
1498 terminate(self());
1499 return;
1500 } else if (future.isFailed()) {
1501 // If the `cgroup` still exists in the hierarchy, treat this as
1502 // an error; otherwise, treat this as a success since the `cgroup`
1503 // has actually been cleaned up.
1504 if (os::exists(path::join(hierarchy, cgroup))) {
1505 promise.fail(future.failure());
1506 } else {
1507 promise.set(Nothing());
1508 }
1509
1510 terminate(self());
1511 return;
1512 }
1513
1514 // Verify the cgroup is now empty.
1515 Try<set<pid_t>> processes = cgroups::processes(hierarchy, cgroup);
1516
1517 // If the `cgroup` is already removed, treat this as a success.
1518 if ((processes.isError() || !processes->empty()) &&
1519 os::exists(path::join(hierarchy, cgroup))) {
1520 promise.fail("Failed to kill all processes in cgroup: " +
1521 (processes.isError() ? processes.error()
1522 : "processes remain"));
1523 terminate(self());
1524 return;
1525 }
1526
1527 promise.set(Nothing());
1528 terminate(self());
1529 }
1530
1531 const string hierarchy;
1532 const string cgroup;

Callers

nothing calls this directly

Calls 13

NothingClass · 0.85
isDiscardedMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
existsFunction · 0.70
processesFunction · 0.70
errorMethod · 0.65
terminateFunction · 0.50
joinFunction · 0.50
failMethod · 0.45
setMethod · 0.45
isErrorMethod · 0.45

Tested by

no test coverage detected