| 7341 | |
| 7342 | |
| 7343 | void Slave::removeFramework(Framework* framework) |
| 7344 | { |
| 7345 | CHECK_NOTNULL(framework); |
| 7346 | |
| 7347 | LOG(INFO)<< "Cleaning up framework " << framework->id(); |
| 7348 | |
| 7349 | CHECK(framework->state == Framework::RUNNING || |
| 7350 | framework->state == Framework::TERMINATING); |
| 7351 | |
| 7352 | // We only remove frameworks once they become idle. |
| 7353 | CHECK(framework->idle()); |
| 7354 | |
| 7355 | // Close all task status update streams for this framework. |
| 7356 | taskStatusUpdateManager->cleanup(framework->id()); |
| 7357 | |
| 7358 | // Schedule the framework work and meta directories for garbage |
| 7359 | // collection. |
| 7360 | // TODO(vinod): Move the responsibility of gc'ing to the |
| 7361 | // Framework struct. |
| 7362 | |
| 7363 | const string path = paths::getFrameworkPath( |
| 7364 | flags.work_dir, info.id(), framework->id()); |
| 7365 | |
| 7366 | os::utime(path); // Update the modification time. |
| 7367 | garbageCollect(path); |
| 7368 | |
| 7369 | if (framework->info.checkpoint()) { |
| 7370 | // Schedule the framework meta directory to get garbage collected. |
| 7371 | const string path = paths::getFrameworkPath( |
| 7372 | metaDir, info.id(), framework->id()); |
| 7373 | |
| 7374 | os::utime(path); // Update the modification time. |
| 7375 | garbageCollect(path); |
| 7376 | } |
| 7377 | |
| 7378 | frameworks.erase(framework->id()); |
| 7379 | |
| 7380 | // Pass ownership of the framework pointer. |
| 7381 | completedFrameworks.set(framework->id(), Owned<Framework>(framework)); |
| 7382 | |
| 7383 | updateDrainStatus(); |
| 7384 | |
| 7385 | if (state == TERMINATING && frameworks.empty()) { |
| 7386 | terminate(self()); |
| 7387 | } |
| 7388 | } |
| 7389 | |
| 7390 | |
| 7391 | void Slave::shutdownExecutor( |