| 6346 | |
| 6347 | |
| 6348 | void Slave::__statusUpdate( |
| 6349 | const Option<Future<Nothing>>& future, |
| 6350 | const StatusUpdate& update, |
| 6351 | const Option<UPID>& pid, |
| 6352 | const ExecutorID& executorId, |
| 6353 | const ContainerID& containerId, |
| 6354 | bool checkpoint) |
| 6355 | { |
| 6356 | if (future.isSome() && !future->isReady()) { |
| 6357 | LOG(ERROR) << "Failed to update resources for container " << containerId |
| 6358 | << " of executor '" << executorId |
| 6359 | << "' running task " << update.status().task_id() |
| 6360 | << " on status update for terminal task, destroying container: " |
| 6361 | << (future->isFailed() ? future->failure() : "discarded"); |
| 6362 | |
| 6363 | containerizer->destroy(containerId); |
| 6364 | |
| 6365 | Executor* executor = getExecutor(update.framework_id(), executorId); |
| 6366 | if (executor != nullptr) { |
| 6367 | Framework* framework = getFramework(update.framework_id()); |
| 6368 | CHECK_NOTNULL(framework); |
| 6369 | |
| 6370 | // Send TASK_GONE because the task was started but has now |
| 6371 | // been terminated. If the framework is not partition-aware, |
| 6372 | // we send TASK_LOST instead for backward compatibility. |
| 6373 | mesos::TaskState taskState = TASK_GONE; |
| 6374 | if (!framework->capabilities.partitionAware) { |
| 6375 | taskState = TASK_LOST; |
| 6376 | } |
| 6377 | |
| 6378 | ContainerTermination termination; |
| 6379 | termination.set_state(taskState); |
| 6380 | termination.set_reason(TaskStatus::REASON_CONTAINER_UPDATE_FAILED); |
| 6381 | termination.set_message( |
| 6382 | "Failed to update resources for container: " + |
| 6383 | (future->isFailed() ? future->failure() : "discarded")); |
| 6384 | |
| 6385 | executor->pendingTermination = termination; |
| 6386 | |
| 6387 | // TODO(jieyu): Set executor->state to be TERMINATING. |
| 6388 | } |
| 6389 | } |
| 6390 | |
| 6391 | if (checkpoint) { |
| 6392 | // Ask the task status update manager to checkpoint and reliably send the |
| 6393 | // update. |
| 6394 | taskStatusUpdateManager->update(update, info.id(), executorId, containerId) |
| 6395 | .onAny(defer(self(), &Slave::___statusUpdate, lambda::_1, update, pid)); |
| 6396 | } else { |
| 6397 | // Ask the task status update manager to just retry the update. |
| 6398 | taskStatusUpdateManager->update(update, info.id()) |
| 6399 | .onAny(defer(self(), &Slave::___statusUpdate, lambda::_1, update, pid)); |
| 6400 | } |
| 6401 | } |
| 6402 | |
| 6403 | |
| 6404 | void Slave::___statusUpdate( |