| 2615 | |
| 2616 | |
| 2617 | Future<Nothing> Slave::_run( |
| 2618 | const FrameworkInfo& frameworkInfo, |
| 2619 | const ExecutorInfo& executorInfo, |
| 2620 | const Option<TaskInfo>& task, |
| 2621 | const Option<TaskGroupInfo>& taskGroup, |
| 2622 | const std::vector<ResourceVersionUUID>& resourceVersionUuids, |
| 2623 | const Option<bool>& launchExecutor) |
| 2624 | { |
| 2625 | // TODO(anindya_sinha): Consider refactoring the initial steps common |
| 2626 | // to `_run()` and `__run()`. |
| 2627 | CHECK_NE(task.isSome(), taskGroup.isSome()) |
| 2628 | << "Either task or task group should be set but not both"; |
| 2629 | |
| 2630 | vector<TaskInfo> tasks; |
| 2631 | if (task.isSome()) { |
| 2632 | tasks.push_back(task.get()); |
| 2633 | } else { |
| 2634 | foreach (const TaskInfo& _task, taskGroup->tasks()) { |
| 2635 | tasks.push_back(_task); |
| 2636 | } |
| 2637 | } |
| 2638 | |
| 2639 | const FrameworkID& frameworkId = frameworkInfo.id(); |
| 2640 | Framework* framework = getFramework(frameworkId); |
| 2641 | if (framework == nullptr) { |
| 2642 | const string error = |
| 2643 | "Ignoring running " + taskOrTaskGroup(task, taskGroup) + |
| 2644 | " because the framework " + stringify(frameworkId) + " does not exist"; |
| 2645 | |
| 2646 | LOG(WARNING) << error; |
| 2647 | |
| 2648 | return Failure(error); |
| 2649 | } |
| 2650 | |
| 2651 | // We don't send a status update here because a terminating |
| 2652 | // framework cannot send acknowledgements. |
| 2653 | if (framework->state == Framework::TERMINATING) { |
| 2654 | const string error = "Ignoring running " + |
| 2655 | taskOrTaskGroup(task, taskGroup) + " of framework " + |
| 2656 | stringify(frameworkId) + |
| 2657 | " because the framework is terminating"; |
| 2658 | |
| 2659 | LOG(WARNING) << error; |
| 2660 | |
| 2661 | // Although we cannot send a status update in this case, we remove |
| 2662 | // the affected tasks from the pending tasks. |
| 2663 | foreach (const TaskInfo& _task, tasks) { |
| 2664 | framework->removePendingTask(_task.task_id()); |
| 2665 | } |
| 2666 | |
| 2667 | if (framework->idle()) { |
| 2668 | removeFramework(framework); |
| 2669 | } |
| 2670 | |
| 2671 | return Failure(error); |
| 2672 | } |
| 2673 | |
| 2674 | // Ignore the launch if killed in the interim. The invariant here |
nothing calls this directly
no test coverage detected