| 8720 | |
| 8721 | |
| 8722 | void Master::markGone(const SlaveID& slaveId, const TimeInfo& goneTime) |
| 8723 | { |
| 8724 | CHECK(slaves.markingGone.contains(slaveId)); |
| 8725 | |
| 8726 | slaves.markingGone.erase(slaveId); |
| 8727 | |
| 8728 | slaves.gone[slaveId] = goneTime; |
| 8729 | |
| 8730 | const string message = "Agent has been marked gone"; |
| 8731 | |
| 8732 | Slave* slave = slaves.registered.get(slaveId); |
| 8733 | |
| 8734 | // If the `Slave` struct does not exist, then the agent |
| 8735 | // must be either recovered or unreachable. |
| 8736 | if (slave == nullptr) { |
| 8737 | CHECK(slaves.recovered.contains(slaveId) || |
| 8738 | slaves.unreachable.contains(slaveId)); |
| 8739 | |
| 8740 | // When a recovered agent is marked gone, we have no task metadata to use in |
| 8741 | // order to send task status updates. We could retain this agent ID and send |
| 8742 | // updates upon reregistration but do not currently do this. See MESOS-9739. |
| 8743 | if (slaves.recovered.contains(slaveId)) { |
| 8744 | return; |
| 8745 | } |
| 8746 | |
| 8747 | slaves.unreachable.erase(slaveId); |
| 8748 | slaves.draining.erase(slaveId); |
| 8749 | slaves.deactivated.erase(slaveId); |
| 8750 | |
| 8751 | // TODO(vinod): Consider moving these tasks into `completedTasks` by |
| 8752 | // transitioning them to a terminal state and sending status updates. |
| 8753 | // But it's not clear what this state should be. If a framework |
| 8754 | // reconciles these tasks after this point it would get `TASK_UNKNOWN` |
| 8755 | // which seems appropriate but we don't keep tasks in this state in-memory. |
| 8756 | if (slaves.unreachableTasks.contains(slaveId)) { |
| 8757 | foreachkey (const FrameworkID& frameworkId, |
| 8758 | slaves.unreachableTasks.at(slaveId)) { |
| 8759 | Framework* framework = getFramework(frameworkId); |
| 8760 | if (framework == nullptr) { |
| 8761 | continue; |
| 8762 | } |
| 8763 | |
| 8764 | TaskState newTaskState = TASK_GONE_BY_OPERATOR; |
| 8765 | TaskStatus::Reason newTaskReason = |
| 8766 | TaskStatus::REASON_SLAVE_REMOVED_BY_OPERATOR; |
| 8767 | |
| 8768 | if (!framework->capabilities.partitionAware) { |
| 8769 | newTaskState = TASK_LOST; |
| 8770 | newTaskReason = TaskStatus::REASON_SLAVE_REMOVED; |
| 8771 | } |
| 8772 | |
| 8773 | foreach (const TaskID& taskId, |
| 8774 | slaves.unreachableTasks.at(slaveId).at(frameworkId)) { |
| 8775 | if (framework->unreachableTasks.contains(taskId)) { |
| 8776 | const Owned<Task>& task = framework->unreachableTasks.at(taskId); |
| 8777 | |
| 8778 | const StatusUpdate& update = protobuf::createStatusUpdate( |
| 8779 | task->framework_id(), |