| 4424 | |
| 4425 | |
| 4426 | void Slave::updateFramework( |
| 4427 | const UpdateFrameworkMessage& message) |
| 4428 | { |
| 4429 | CHECK(state == RECOVERING || state == DISCONNECTED || |
| 4430 | state == RUNNING || state == TERMINATING) |
| 4431 | << state; |
| 4432 | |
| 4433 | const FrameworkID& frameworkId = message.framework_id(); |
| 4434 | const UPID& pid = message.pid(); |
| 4435 | |
| 4436 | if (state != RUNNING) { |
| 4437 | LOG(WARNING) << "Dropping updateFramework message for " << frameworkId |
| 4438 | << " because the agent is in " << state << " state"; |
| 4439 | metrics.invalid_framework_messages++; |
| 4440 | return; |
| 4441 | } |
| 4442 | |
| 4443 | Framework* framework = getFramework(frameworkId); |
| 4444 | if (framework == nullptr) { |
| 4445 | LOG(INFO) << "Ignoring info update for framework " << frameworkId |
| 4446 | << " because it does not exist"; |
| 4447 | return; |
| 4448 | } |
| 4449 | |
| 4450 | switch (framework->state) { |
| 4451 | case Framework::TERMINATING: |
| 4452 | LOG(WARNING) << "Ignoring info update for framework " << frameworkId |
| 4453 | << " because it is terminating"; |
| 4454 | break; |
| 4455 | case Framework::RUNNING: { |
| 4456 | LOG(INFO) << "Updating info for framework " << frameworkId |
| 4457 | << (pid != UPID() ? " with pid updated to " + stringify(pid) |
| 4458 | : ""); |
| 4459 | |
| 4460 | // The framework info was added in 1.3, so it will not be set |
| 4461 | // if from a master older than 1.3. |
| 4462 | if (message.has_framework_info()) { |
| 4463 | framework->info.CopyFrom(message.framework_info()); |
| 4464 | framework->capabilities = protobuf::framework::Capabilities( |
| 4465 | message.framework_info().capabilities()); |
| 4466 | } |
| 4467 | |
| 4468 | if (pid == UPID()) { |
| 4469 | framework->pid = None(); |
| 4470 | } else { |
| 4471 | framework->pid = pid; |
| 4472 | } |
| 4473 | |
| 4474 | if (framework->info.checkpoint()) { |
| 4475 | framework->checkpointFramework(); |
| 4476 | } |
| 4477 | |
| 4478 | // Inform task status update manager to immediately resend any pending |
| 4479 | // updates. |
| 4480 | taskStatusUpdateManager->resume(); |
| 4481 | |
| 4482 | break; |
| 4483 | } |
nothing calls this directly
no test coverage detected