| 7211 | |
| 7212 | |
| 7213 | void Slave::removeExecutor(Framework* framework, Executor* executor) |
| 7214 | { |
| 7215 | CHECK_NOTNULL(framework); |
| 7216 | CHECK_NOTNULL(executor); |
| 7217 | |
| 7218 | LOG(INFO) << "Cleaning up executor " << *executor; |
| 7219 | |
| 7220 | CHECK(framework->state == Framework::RUNNING || |
| 7221 | framework->state == Framework::TERMINATING) |
| 7222 | << framework->state; |
| 7223 | |
| 7224 | // Check that this executor has terminated. |
| 7225 | CHECK(executor->state == Executor::TERMINATED) << executor->state; |
| 7226 | |
| 7227 | // Check that either 1) the executor has no tasks with pending |
| 7228 | // updates or 2) the slave/framework is terminating, because no |
| 7229 | // acknowledgements might be received. |
| 7230 | CHECK(!executor->incompleteTasks() || |
| 7231 | state == TERMINATING || |
| 7232 | framework->state == Framework::TERMINATING); |
| 7233 | |
| 7234 | // Write a sentinel file to indicate that this executor |
| 7235 | // is completed. |
| 7236 | if (executor->checkpoint) { |
| 7237 | const string path = paths::getExecutorSentinelPath( |
| 7238 | metaDir, |
| 7239 | info.id(), |
| 7240 | framework->id(), |
| 7241 | executor->id, |
| 7242 | executor->containerId); |
| 7243 | CHECK_SOME(os::touch(path)); |
| 7244 | } |
| 7245 | |
| 7246 | // TODO(vinod): Move the responsibility of gc'ing to the |
| 7247 | // Executor struct. |
| 7248 | |
| 7249 | // Schedule the executor run work directory to get garbage collected. |
| 7250 | const string path = paths::getExecutorRunPath( |
| 7251 | flags.work_dir, |
| 7252 | info.id(), |
| 7253 | framework->id(), |
| 7254 | executor->id, |
| 7255 | executor->containerId); |
| 7256 | |
| 7257 | // NOTE: We keep a list of default executor tasks here to for |
| 7258 | // detaching task volume directories, since the executor may be |
| 7259 | // already destroyed when the GC completes (MESOS-8460). |
| 7260 | vector<Task> defaultExecutorTasks; |
| 7261 | if (executor->info.has_type() && |
| 7262 | executor->info.type() == ExecutorInfo::DEFAULT) { |
| 7263 | foreachvalue (const Task* task, executor->launchedTasks) { |
| 7264 | defaultExecutorTasks.push_back(*task); |
| 7265 | } |
| 7266 | |
| 7267 | foreachvalue (const Task* task, executor->terminatedTasks) { |
| 7268 | defaultExecutorTasks.push_back(*task); |
| 7269 | } |
| 7270 |
nothing calls this directly
no test coverage detected