| 10810 | |
| 10811 | |
| 10812 | bool Framework::removePendingTask(const TaskID& taskId) |
| 10813 | { |
| 10814 | bool removed = false; |
| 10815 | |
| 10816 | foreachkey (const ExecutorID& executorId, pendingTasks) { |
| 10817 | if (pendingTasks.at(executorId).contains(taskId)) { |
| 10818 | pendingTasks.at(executorId).erase(taskId); |
| 10819 | if (pendingTasks.at(executorId).empty()) { |
| 10820 | pendingTasks.erase(executorId); |
| 10821 | } |
| 10822 | |
| 10823 | removed = true; |
| 10824 | break; |
| 10825 | } |
| 10826 | } |
| 10827 | |
| 10828 | // We also remove the pending task group if all of its |
| 10829 | // tasks have been removed. |
| 10830 | for (auto it = pendingTaskGroups.begin(); |
| 10831 | it != pendingTaskGroups.end(); |
| 10832 | ++it) { |
| 10833 | foreach (const TaskInfo& t, it->tasks()) { |
| 10834 | if (t.task_id() == taskId) { |
| 10835 | // Found its task group, check if all tasks within |
| 10836 | // the group have been removed. |
| 10837 | bool allRemoved = true; |
| 10838 | |
| 10839 | foreach (const TaskInfo& t_, it->tasks()) { |
| 10840 | if (hasTask(t_.task_id())) { |
| 10841 | allRemoved = false; |
| 10842 | break; |
| 10843 | } |
| 10844 | } |
| 10845 | |
| 10846 | if (allRemoved) { |
| 10847 | pendingTaskGroups.erase(it); |
| 10848 | } |
| 10849 | |
| 10850 | return removed; |
| 10851 | } |
| 10852 | } |
| 10853 | } |
| 10854 | |
| 10855 | return removed; |
| 10856 | } |
| 10857 | |
| 10858 | |
| 10859 | Option<ExecutorID> Framework::getExecutorIdForPendingTask( |
no test coverage detected