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

Method kill

src/launcher/default_executor.cpp:1120–1207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118 }
1119
1120 Future<Nothing> kill(
1121 Container* container,
1122 const Option<Duration>& _gracePeriod = None())
1123 {
1124 if (!container->launched) {
1125 // We can get here if we're killing a task group for which multiple
1126 // containers failed to launch.
1127 return Nothing();
1128 }
1129
1130 if (container->maxCompletionTimer.isSome()) {
1131 Clock::cancel(container->maxCompletionTimer.get());
1132 container->maxCompletionTimer = None();
1133 }
1134
1135 CHECK(!container->killing);
1136 container->killing = true;
1137
1138 // If the task is checked, pause the associated checker.
1139 //
1140 // TODO(alexr): Once we support `TASK_KILLING` in this executor,
1141 // consider continuing checking the task after sending `TASK_KILLING`.
1142 if (container->checker.isSome()) {
1143 CHECK_NOTNULL(container->checker->get());
1144 container->checker->get()->pause();
1145 container->checker = None();
1146 }
1147
1148 // If the task is health checked, pause the associated health checker.
1149 //
1150 // TODO(alexr): Once we support `TASK_KILLING` in this executor,
1151 // consider health checking the task after sending `TASK_KILLING`.
1152 if (container->healthChecker.isSome()) {
1153 CHECK_NOTNULL(container->healthChecker->get());
1154 container->healthChecker->get()->pause();
1155 container->healthChecker = None();
1156 }
1157
1158 const TaskID& taskId = container->taskInfo.task_id();
1159
1160 LOG(INFO)
1161 << "Killing task " << taskId << " running in child container"
1162 << " " << container->containerId << " with SIGTERM signal";
1163
1164 // Default grace period is set to 3s.
1165 Duration gracePeriod = Seconds(3);
1166
1167 if (_gracePeriod.isSome()) {
1168 gracePeriod = _gracePeriod.get();
1169 }
1170
1171 LOG(INFO) << "Scheduling escalation to SIGKILL in " << gracePeriod
1172 << " from now";
1173
1174 const ContainerID& containerId = container->containerId;
1175
1176 delay(gracePeriod,
1177 self(),

Callers 1

receivedMethod · 0.45

Calls 15

NoneClass · 0.85
NothingClass · 0.85
SecondsClass · 0.85
frameworkHasCapabilityFunction · 0.85
createTaskStatusFunction · 0.85
FailureClass · 0.85
strsignalFunction · 0.85
CopyFromMethod · 0.80
delayFunction · 0.50
killFunction · 0.50
postFunction · 0.50
stringifyFunction · 0.50

Tested by

no test coverage detected