| 5481 | |
| 5482 | |
| 5483 | void Slave::registerExecutor( |
| 5484 | const UPID& from, |
| 5485 | const FrameworkID& frameworkId, |
| 5486 | const ExecutorID& executorId) |
| 5487 | { |
| 5488 | LOG(INFO) << "Got registration for executor '" << executorId |
| 5489 | << "' of framework " << frameworkId << " from " |
| 5490 | << stringify(from); |
| 5491 | |
| 5492 | CHECK(state == RECOVERING || state == DISCONNECTED || |
| 5493 | state == RUNNING || state == TERMINATING) |
| 5494 | << state; |
| 5495 | |
| 5496 | if (state == RECOVERING) { |
| 5497 | LOG(WARNING) << "Shutting down executor '" << executorId |
| 5498 | << "' of framework " << frameworkId |
| 5499 | << " because the agent is still recovering"; |
| 5500 | reply(ShutdownExecutorMessage()); |
| 5501 | return; |
| 5502 | } |
| 5503 | |
| 5504 | if (state == TERMINATING) { |
| 5505 | LOG(WARNING) << "Shutting down executor '" << executorId |
| 5506 | << "' of framework " << frameworkId |
| 5507 | << " because the agent is terminating"; |
| 5508 | reply(ShutdownExecutorMessage()); |
| 5509 | return; |
| 5510 | } |
| 5511 | |
| 5512 | Framework* framework = getFramework(frameworkId); |
| 5513 | if (framework == nullptr) { |
| 5514 | LOG(WARNING) << "Shutting down executor '" << executorId |
| 5515 | << "' as the framework " << frameworkId |
| 5516 | << " does not exist"; |
| 5517 | |
| 5518 | reply(ShutdownExecutorMessage()); |
| 5519 | return; |
| 5520 | } |
| 5521 | |
| 5522 | CHECK(framework->state == Framework::RUNNING || |
| 5523 | framework->state == Framework::TERMINATING) |
| 5524 | << framework->state; |
| 5525 | |
| 5526 | if (framework->state == Framework::TERMINATING) { |
| 5527 | LOG(WARNING) << "Shutting down executor '" << executorId |
| 5528 | << "' as the framework " << frameworkId |
| 5529 | << " is terminating"; |
| 5530 | |
| 5531 | reply(ShutdownExecutorMessage()); |
| 5532 | return; |
| 5533 | } |
| 5534 | |
| 5535 | Executor* executor = framework->getExecutor(executorId); |
| 5536 | |
| 5537 | // Check the status of the executor. |
| 5538 | if (executor == nullptr) { |
| 5539 | LOG(WARNING) << "Unexpected executor '" << executorId |
| 5540 | << "' registering for framework " << frameworkId; |
nothing calls this directly
no test coverage detected