| 2810 | |
| 2811 | |
| 2812 | void Slave::__run( |
| 2813 | const FrameworkInfo& frameworkInfo, |
| 2814 | const ExecutorInfo& executorInfo, |
| 2815 | const Option<TaskInfo>& task, |
| 2816 | const Option<TaskGroupInfo>& taskGroup, |
| 2817 | const vector<ResourceVersionUUID>& resourceVersionUuids, |
| 2818 | const Option<bool>& launchExecutor, |
| 2819 | bool executorGeneratedForCommandTask) |
| 2820 | { |
| 2821 | CHECK_NE(task.isSome(), taskGroup.isSome()) |
| 2822 | << "Either task or task group should be set but not both"; |
| 2823 | |
| 2824 | vector<TaskInfo> tasks; |
| 2825 | if (task.isSome()) { |
| 2826 | tasks.push_back(task.get()); |
| 2827 | } else { |
| 2828 | foreach (const TaskInfo& _task, taskGroup->tasks()) { |
| 2829 | tasks.push_back(_task); |
| 2830 | } |
| 2831 | } |
| 2832 | |
| 2833 | const FrameworkID& frameworkId = frameworkInfo.id(); |
| 2834 | Framework* framework = getFramework(frameworkId); |
| 2835 | if (framework == nullptr) { |
| 2836 | LOG(WARNING) << "Ignoring running " << taskOrTaskGroup(task, taskGroup) |
| 2837 | << " because the framework " << frameworkId |
| 2838 | << " does not exist"; |
| 2839 | |
| 2840 | if (launchExecutor.isSome() && launchExecutor.get()) { |
| 2841 | // Master expects a new executor to be launched for this task(s). |
| 2842 | // To keep the master executor entries updated, the agent needs to send |
| 2843 | // `ExitedExecutorMessage` even though no executor launched. |
| 2844 | sendExitedExecutorMessage(frameworkId, executorInfo.executor_id()); |
| 2845 | |
| 2846 | // There is no need to clean up the task launch sequence here since |
| 2847 | // the framework (along with the sequence) no longer exists. |
| 2848 | } |
| 2849 | |
| 2850 | return; |
| 2851 | } |
| 2852 | |
| 2853 | const ExecutorID& executorId = executorInfo.executor_id(); |
| 2854 | |
| 2855 | // We report TASK_DROPPED to the framework because the task was |
| 2856 | // never launched. For non-partition-aware frameworks, we report |
| 2857 | // TASK_LOST for backward compatibility. |
| 2858 | auto sendTaskDroppedUpdate = |
| 2859 | [&](TaskStatus::Reason reason, const string& message) { |
| 2860 | mesos::TaskState taskState = TASK_DROPPED; |
| 2861 | |
| 2862 | if (!protobuf::frameworkHasCapability( |
| 2863 | frameworkInfo, FrameworkInfo::Capability::PARTITION_AWARE)) { |
| 2864 | taskState = TASK_LOST; |
| 2865 | } |
| 2866 | |
| 2867 | foreach (const TaskInfo& _task, tasks) { |
| 2868 | const StatusUpdate update = protobuf::createStatusUpdate( |
| 2869 | frameworkId, |
nothing calls this directly
no test coverage detected