| 3484 | |
| 3485 | |
| 3486 | void Slave::___run( |
| 3487 | const Future<Nothing>& future, |
| 3488 | const FrameworkID& frameworkId, |
| 3489 | const ExecutorID& executorId, |
| 3490 | const ContainerID& containerId, |
| 3491 | const vector<TaskInfo>& tasks, |
| 3492 | const vector<TaskGroupInfo>& taskGroups) |
| 3493 | { |
| 3494 | if (!future.isReady()) { |
| 3495 | LOG(ERROR) << "Failed to update resources for container " << containerId |
| 3496 | << " of executor '" << executorId |
| 3497 | << "' of framework " << frameworkId |
| 3498 | << ", destroying container: " |
| 3499 | << (future.isFailed() ? future.failure() : "discarded"); |
| 3500 | |
| 3501 | containerizer->destroy(containerId); |
| 3502 | |
| 3503 | Executor* executor = getExecutor(frameworkId, executorId); |
| 3504 | if (executor != nullptr) { |
| 3505 | Framework* framework = getFramework(frameworkId); |
| 3506 | CHECK_NOTNULL(framework); |
| 3507 | |
| 3508 | // Send TASK_GONE because the task was started but has now |
| 3509 | // been terminated. If the framework is not partition-aware, |
| 3510 | // we send TASK_LOST instead for backward compatibility. |
| 3511 | mesos::TaskState taskState = TASK_GONE; |
| 3512 | if (!framework->capabilities.partitionAware) { |
| 3513 | taskState = TASK_LOST; |
| 3514 | } |
| 3515 | |
| 3516 | ContainerTermination termination; |
| 3517 | termination.set_state(taskState); |
| 3518 | termination.set_reason(TaskStatus::REASON_CONTAINER_UPDATE_FAILED); |
| 3519 | termination.set_message( |
| 3520 | "Failed to update resources for container: " + |
| 3521 | (future.isFailed() ? future.failure() : "discarded")); |
| 3522 | |
| 3523 | executor->pendingTermination = termination; |
| 3524 | |
| 3525 | // TODO(jieyu): Set executor->state to be TERMINATING. |
| 3526 | } |
| 3527 | |
| 3528 | return; |
| 3529 | } |
| 3530 | |
| 3531 | // Needed for logging. |
| 3532 | auto tasksAndTaskGroups = [&tasks, &taskGroups]() { |
| 3533 | ostringstream out; |
| 3534 | if (!tasks.empty()) { |
| 3535 | vector<TaskID> taskIds; |
| 3536 | foreach (const TaskInfo& task, tasks) { |
| 3537 | taskIds.push_back(task.task_id()); |
| 3538 | } |
| 3539 | out << "tasks " << stringify(taskIds); |
| 3540 | } |
| 3541 | |
| 3542 | if (!taskGroups.empty()) { |
| 3543 | if (!tasks.empty()) { |
nothing calls this directly
no test coverage detected