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

Method killTask

src/slave/slave.cpp:3965–4057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3963
3964
3965void Slave::killTask(
3966 const UPID& from,
3967 const KillTaskMessage& killTaskMessage)
3968{
3969 if (master != from) {
3970 LOG(WARNING) << "Ignoring kill task message from " << from
3971 << " because it is not the expected master: "
3972 << (master.isSome() ? stringify(master.get()) : "None");
3973 return;
3974 }
3975
3976 const FrameworkID& frameworkId = killTaskMessage.framework_id();
3977 const TaskID& taskId = killTaskMessage.task_id();
3978
3979 LOG(INFO) << "Asked to kill task " << taskId
3980 << " of framework " << frameworkId;
3981
3982 CHECK(state == RECOVERING || state == DISCONNECTED ||
3983 state == RUNNING || state == TERMINATING)
3984 << state;
3985
3986 // TODO(bmahler): Also ignore if we're DISCONNECTED.
3987 if (state == RECOVERING || state == TERMINATING) {
3988 LOG(WARNING) << "Cannot kill task " << taskId
3989 << " of framework " << frameworkId
3990 << " because the agent is " << state;
3991 // TODO(vinod): Consider sending a TASK_LOST here.
3992 // Currently it is tricky because 'statusUpdate()'
3993 // ignores updates for unknown frameworks.
3994 return;
3995 }
3996
3997 Framework* framework = getFramework(frameworkId);
3998 if (framework == nullptr) {
3999 LOG(WARNING) << "Ignoring kill task " << taskId
4000 << " of framework " << frameworkId
4001 << " because no such framework is running";
4002 return;
4003 }
4004
4005 // We don't send a status update here because a terminating
4006 // framework cannot send acknowledgements.
4007 if (framework->state == Framework::TERMINATING) {
4008 LOG(WARNING) << "Ignoring kill task " << taskId
4009 << " of framework " << frameworkId
4010 << " because the framework is terminating";
4011 return;
4012 }
4013
4014 CHECK(framework->state == Framework::RUNNING) << framework->state;
4015
4016 if (framework->isPending(taskId)) {
4017 killPendingTask(frameworkId, framework, taskId);
4018
4019 return;
4020 }
4021
4022 Executor* executor = framework->getExecutor(taskId);

Callers

nothing calls this directly

Calls 10

createStatusUpdateFunction · 0.85
randomFunction · 0.85
getExecutorMethod · 0.80
stringifyFunction · 0.50
UPIDClass · 0.50
killFunction · 0.50
isSomeMethod · 0.45
getMethod · 0.45
isPendingMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected