| 11035 | |
| 11036 | |
| 11037 | void Executor::completeTask(const TaskID& taskId) |
| 11038 | { |
| 11039 | VLOG(1) << "Completing task " << taskId; |
| 11040 | |
| 11041 | CHECK(terminatedTasks.contains(taskId)) |
| 11042 | << "Failed to find terminated task " << taskId; |
| 11043 | |
| 11044 | // If `completedTasks` is full and this is a default executor, we need |
| 11045 | // to detach the volume directory for the first task in `completedTasks` |
| 11046 | // before pushing a task into it, otherwise, we will never have chance |
| 11047 | // to do the detach for that task which would be a leak. |
| 11048 | if (info.has_type() && |
| 11049 | info.type() == ExecutorInfo::DEFAULT && |
| 11050 | completedTasks.full()) { |
| 11051 | const shared_ptr<Task>& firstTask = completedTasks.front(); |
| 11052 | slave->detachTaskVolumeDirectories(info, containerId, {*firstTask}); |
| 11053 | } |
| 11054 | |
| 11055 | // Mark the task metadata (TaskInfo and status updates) for garbage |
| 11056 | // collection. This is important for keeping the metadata of long-lived, |
| 11057 | // multi-task executors within reasonable levels. |
| 11058 | if (checkpoint) { |
| 11059 | slave->garbageCollect(paths::getTaskPath( |
| 11060 | slave->metaDir, |
| 11061 | slave->info.id(), |
| 11062 | frameworkId, |
| 11063 | id, |
| 11064 | containerId, |
| 11065 | taskId)); |
| 11066 | } |
| 11067 | |
| 11068 | Task* task = terminatedTasks[taskId]; |
| 11069 | completedTasks.push_back(shared_ptr<Task>(task)); |
| 11070 | terminatedTasks.erase(taskId); |
| 11071 | } |
| 11072 | |
| 11073 | |
| 11074 | void Executor::checkpointExecutor() |
no test coverage detected