Launches an executor which was previously created.
| 3736 | |
| 3737 | // Launches an executor which was previously created. |
| 3738 | void Slave::launchExecutor( |
| 3739 | const Future<Option<Secret>>& authenticationToken, |
| 3740 | const FrameworkID& frameworkId, |
| 3741 | const ExecutorInfo& executorInfo, |
| 3742 | const google::protobuf::Map<string, Value::Scalar>& executorLimits, |
| 3743 | const Option<TaskInfo>& taskInfo) |
| 3744 | { |
| 3745 | Framework* framework = getFramework(frameworkId); |
| 3746 | if (framework == nullptr) { |
| 3747 | LOG(WARNING) << "Ignoring launching executor '" |
| 3748 | << executorInfo.executor_id() << "' because the framework " |
| 3749 | << frameworkId << " does not exist"; |
| 3750 | return; |
| 3751 | } |
| 3752 | |
| 3753 | if (framework->state == Framework::TERMINATING) { |
| 3754 | LOG(WARNING) << "Ignoring launching executor '" |
| 3755 | << executorInfo.executor_id() << "' of framework " |
| 3756 | << frameworkId << " because the framework is terminating"; |
| 3757 | return; |
| 3758 | } |
| 3759 | |
| 3760 | Executor* executor = framework->getExecutor(executorInfo.executor_id()); |
| 3761 | if (executor == nullptr) { |
| 3762 | LOG(WARNING) << "Ignoring launching executor '" |
| 3763 | << executorInfo.executor_id() << "' of framework " |
| 3764 | << frameworkId << " because the executor does not exist"; |
| 3765 | return; |
| 3766 | } |
| 3767 | |
| 3768 | if (executor->state == Executor::TERMINATING || |
| 3769 | executor->state == Executor::TERMINATED) { |
| 3770 | string executorState; |
| 3771 | if (executor->state == Executor::TERMINATING) { |
| 3772 | executorState = "terminating"; |
| 3773 | } else { |
| 3774 | executorState = "terminated"; |
| 3775 | } |
| 3776 | |
| 3777 | LOG(WARNING) << "Ignoring launching executor " << *executor |
| 3778 | << " in container " << executor->containerId |
| 3779 | << " because the executor is " << executorState; |
| 3780 | |
| 3781 | // The framework may have shutdown this executor already, transitioning it |
| 3782 | // to the TERMINATING/TERMINATED state. However, the executor still exists |
| 3783 | // in the agent's map, so we must send status updates for any queued tasks |
| 3784 | // and perform cleanup via `executorTerminated`. |
| 3785 | ContainerTermination termination; |
| 3786 | termination.set_state(TASK_FAILED); |
| 3787 | termination.set_reason(TaskStatus::REASON_CONTAINER_LAUNCH_FAILED); |
| 3788 | termination.set_message("Executor " + executorState); |
| 3789 | |
| 3790 | executorTerminated(frameworkId, executor->id, termination); |
| 3791 | |
| 3792 | return; |
| 3793 | } |
| 3794 | |
| 3795 | CHECK_EQ(Executor::REGISTERING, executor->state); |
nothing calls this directly
no test coverage detected