| 3258 | |
| 3259 | |
| 3260 | void MesosContainerizerProcess::limited( |
| 3261 | const ContainerID& containerId, |
| 3262 | const Future<ContainerLimitation>& future) |
| 3263 | { |
| 3264 | if (!containers_.contains(containerId) || |
| 3265 | containers_.at(containerId)->state == DESTROYING) { |
| 3266 | return; |
| 3267 | } |
| 3268 | |
| 3269 | Option<ContainerTermination> termination = None(); |
| 3270 | |
| 3271 | if (future.isReady()) { |
| 3272 | LOG_BASED_ON_CLASS(containers_.at(containerId)->containerClass()) |
| 3273 | << "Container " << containerId << " has reached its limit for resource " |
| 3274 | << future->resources() << " and will be terminated"; |
| 3275 | |
| 3276 | termination = ContainerTermination(); |
| 3277 | termination->set_state(TaskState::TASK_FAILED); |
| 3278 | termination->set_message(future->message()); |
| 3279 | |
| 3280 | if (future->has_reason()) { |
| 3281 | termination->set_reason(future->reason()); |
| 3282 | } |
| 3283 | |
| 3284 | if (!future->resources().empty()) { |
| 3285 | termination->mutable_limited_resources()->CopyFrom( |
| 3286 | future->resources()); |
| 3287 | } |
| 3288 | } else { |
| 3289 | // TODO(idownes): A discarded future will not be an error when |
| 3290 | // isolators discard their promises after cleanup. |
| 3291 | LOG(ERROR) << "Error in a resource limitation for container " |
| 3292 | << containerId << ": " << (future.isFailed() ? future.failure() |
| 3293 | : "discarded"); |
| 3294 | } |
| 3295 | |
| 3296 | // The container has been affected by the limitation so destroy it. |
| 3297 | destroy(containerId, termination); |
| 3298 | } |
| 3299 | |
| 3300 | |
| 3301 | Future<hashset<ContainerID>> MesosContainerizerProcess::containers() |
nothing calls this directly
no test coverage detected