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

Method killTask

src/exec/exec.cpp:343–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341 }
342
343 void killTask(KillTaskMessage&& killTaskMessage)
344 {
345 const TaskID taskId = killTaskMessage.task_id();
346
347 if (aborted.load()) {
348 VLOG(1) << "Ignoring kill task message for task " << taskId
349 << " because the driver is aborted!";
350 return;
351 }
352
353 // A kill task request is received when the driver is not connected. This
354 // can happen, for example, if `ExecutorRegisteredMessage` has not been
355 // delivered. We do not shutdown the driver because there might be other
356 // still running tasks and the executor might eventually reconnect, e.g.,
357 // after the agent failover. We do not drop ignore the message because the
358 // actual executor may still want to react, e.g., commit suicide.
359 if (!connected) {
360 LOG(WARNING) << "Executor received kill task message for task " << taskId
361 << " while disconnected from the agent!";
362 }
363
364 VLOG(1) << "Executor asked to kill task '" << taskId << "'";
365
366 Stopwatch stopwatch;
367 if (FLAGS_v >= 1) {
368 stopwatch.start();
369 }
370
371 // If this is a Docker executor, call the `killTask()` overload which
372 // allows the kill policy to be overridden.
373 auto* dockerExecutor = dynamic_cast<docker::DockerExecutor*>(executor);
374 if (dockerExecutor) {
375 Option<KillPolicy> killPolicy = killTaskMessage.has_kill_policy()
376 ? killTaskMessage.kill_policy()
377 : Option<KillPolicy>::none();
378
379 dockerExecutor->killTask(driver, taskId, killPolicy);
380 } else {
381 executor->killTask(driver, taskId);
382 }
383
384 VLOG(1) << "Executor::killTask took " << stopwatch.elapsed();
385 }
386
387 void statusUpdateAcknowledgement(
388 const SlaveID& slaveId,

Callers

nothing calls this directly

Calls 4

elapsedMethod · 0.80
startMethod · 0.65
killTaskMethod · 0.65
loadMethod · 0.45

Tested by

no test coverage detected