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

Method killPendingTask

src/slave/slave.cpp:4060–4109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4058
4059
4060void Slave::killPendingTask(
4061 const FrameworkID& frameworkId,
4062 Framework* framework,
4063 const TaskID& taskId)
4064{
4065 LOG(WARNING) << "Killing task " << taskId
4066 << " of framework " << frameworkId
4067 << " before it was launched";
4068
4069 Option<TaskGroupInfo> taskGroup =
4070 framework->getTaskGroupForPendingTask(taskId);
4071
4072 vector<StatusUpdate> updates;
4073 if (taskGroup.isSome()) {
4074 foreach (const TaskInfo& task, taskGroup->tasks()) {
4075 updates.push_back(protobuf::createStatusUpdate(
4076 frameworkId,
4077 info.id(),
4078 task.task_id(),
4079 TASK_KILLED,
4080 TaskStatus::SOURCE_SLAVE,
4081 id::UUID::random(),
4082 "A task within the task group was killed before"
4083 " delivery to the executor",
4084 TaskStatus::REASON_TASK_KILLED_DURING_LAUNCH,
4085 CHECK_NOTNONE(
4086 framework->getExecutorIdForPendingTask(task.task_id()))));
4087 }
4088 } else {
4089 updates.push_back(protobuf::createStatusUpdate(
4090 frameworkId,
4091 info.id(),
4092 taskId,
4093 TASK_KILLED,
4094 TaskStatus::SOURCE_SLAVE,
4095 id::UUID::random(),
4096 "Killed before delivery to the executor",
4097 TaskStatus::REASON_TASK_KILLED_DURING_LAUNCH,
4098 CHECK_NOTNONE(
4099 framework->getExecutorIdForPendingTask(taskId))));
4100 }
4101
4102 foreach (const StatusUpdate& update, updates) {
4103 // NOTE: Sending a terminal update (TASK_KILLED) synchronously
4104 // removes the task/task group from 'framework->pendingTasks'
4105 // and 'framework->pendingTaskGroups', so that it will not be
4106 // launched.
4107 statusUpdate(update, UPID());
4108 }
4109}
4110
4111
4112void Slave::kill(

Callers

nothing calls this directly

Calls 6

createStatusUpdateFunction · 0.85
randomFunction · 0.85
isSomeMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected