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

Method shutdown

src/docker/executor.cpp:457–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455 void frameworkMessage(ExecutorDriver* driver, const string& data) {}
456
457 void shutdown(ExecutorDriver* driver)
458 {
459 LOG(INFO) << "Shutting down";
460
461 // Currently, 'docker->run' uses the reaper internally, hence we need
462 // to account for the reap interval. We also leave a small buffer of
463 // time to do the forced kill, otherwise the agent may destroy the
464 // container before we can send `TASK_KILLED`.
465 //
466 // TODO(alexr): Remove `MAX_REAP_INTERVAL` once the reaper signals
467 // immediately after the watched process has exited.
468 Duration gracePeriod =
469 shutdownGracePeriod - process::MAX_REAP_INTERVAL() - Seconds(1);
470
471 // Since the docker executor manages a single task,
472 // shutdown boils down to killing this task.
473 //
474 // TODO(bmahler): If a shutdown arrives after a kill task within
475 // the grace period of the `KillPolicy`, we may need to escalate
476 // more quickly (e.g. the shutdown grace period allotted by the
477 // agent is smaller than the kill grace period).
478 if (run.isSome()) {
479 CHECK_SOME(taskId);
480 killTask(driver, taskId.get(), gracePeriod);
481 } else {
482 driver->stop();
483 }
484 }
485
486 void error(ExecutorDriver* driver, const string& message) {}
487

Callers

nothing calls this directly

Calls 5

MAX_REAP_INTERVALFunction · 0.85
SecondsClass · 0.85
stopMethod · 0.65
isSomeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected