private Optional<String> getStatusMessage(Protos.TaskStatus status, Optional<SingularityTask> task) { if (status.hasMessage() && !Strings.isNullOrEmpty(status.getMessage())) { return Optional.of(status.getMessage()); } else if (status.hasReason() && status.getReason() == Reason.REASON_CONTAINER_LIMITATION_MEMORY) { if (task.isPresent() && task.get().getTaskRequest().getDeploy().getResources().isPresent()) { if (task.get().getTaskRequest().getDeploy().getResources().get().getDiskMb() > 0) { return Optional.of(String.format("Task exceeded one or more memory limits (%s MB mem, %s MB disk).", task.get().getTaskRequest().getDeploy().getResources().get().getMemoryMb(), task.get().getTaskRequest().getDeploy().getResources().get().getDiskMb())); } else { return Optional.of(String.format("Task exceeded memory limit (%s MB mem).", task.get().getTaskRequest().getDeploy().getResources().get().getMemoryMb())); } } return Optional.of("Task exceeded memory limit."); } else if (status.hasReason() && status.getReason() == Reason.REASON_CONTAINER_LIMITATION_DISK) { if (task.isPresent() && task.get().getTaskRequest().getDeploy().getResources().isPresent()) { return Optional.of(String.format("Task exceeded disk limit (%s MB disk).", task.get().getTaskRequest().getDeploy().getResources().get().getDiskMb())); } else { return Optional.of("Task exceeded disk limit."); } } return Optional.absent(); }
if (!status.hasReason() || !status.getReason().equals(Reason.REASON_INVALID_OFFERS)) { if (!state.isSuccess() && taskHistoryUpdateCreateResult == SingularityCreateResult.CREATED && cooldown.shouldEnterCooldown(request, taskId, requestState, deployStatistics, timestamp)) { LOG.info("Request {} is entering cooldown due to task {}", request.getId(), taskId);
status.getReason() == Reason.REASON_INVALID_OFFERS || status.getReason() == Reason.REASON_AGENT_REMOVED || status.getReason() == Reason.REASON_AGENT_RESTARTED || status.getReason() == Reason.REASON_AGENT_UNKNOWN || status.getReason() == Reason.REASON_MASTER_DISCONNECTED || status.getReason() == Reason.REASON_AGENT_DISCONNECTED; taskLostReasons.add(status.getReason()); new SingularityTaskHistoryUpdate(taskIdObj, timestamp, taskState, statusMessage, status.hasReason() ? Optional.of(status.getReason().name()) : Optional.<String>absent()); final SingularityCreateResult taskHistoryUpdateCreateResult = taskManager.saveTaskHistoryUpdate(taskUpdate);
status.getReason() == Reason.REASON_INVALID_OFFERS || status.getReason() == Reason.REASON_AGENT_REMOVED || status.getReason() == Reason.REASON_AGENT_RESTARTED || status.getReason() == Reason.REASON_AGENT_UNKNOWN || status.getReason() == Reason.REASON_MASTER_DISCONNECTED || status.getReason() == Reason.REASON_AGENT_DISCONNECTED; taskLostReasons.add(status.getReason()); new SingularityTaskHistoryUpdate(taskIdObj, timestamp, taskState, statusMessage, status.hasReason() ? Optional.of(status.getReason().name()) : Optional.<String>absent()); final SingularityCreateResult taskHistoryUpdateCreateResult = taskManager.saveTaskHistoryUpdate(taskUpdate);
if (!status.hasReason() || !status.getReason().equals(Reason.REASON_INVALID_OFFERS)) { if (!state.isSuccess() && taskHistoryUpdateCreateResult == SingularityCreateResult.CREATED && cooldown.shouldEnterCooldown(request, taskId, requestState, deployStatistics, timestamp)) { LOG.info("Request {} is entering cooldown due to task {}", request.getId(), taskId);
private Optional<String> getStatusMessage(Protos.TaskStatus status, Optional<SingularityTask> task) { if (status.hasMessage() && !Strings.isNullOrEmpty(status.getMessage())) { return Optional.of(status.getMessage()); } else if (status.hasReason() && status.getReason() == Reason.REASON_CONTAINER_LIMITATION_MEMORY) { if (task.isPresent() && task.get().getTaskRequest().getDeploy().getResources().isPresent()) { if (task.get().getTaskRequest().getDeploy().getResources().get().getDiskMb() > 0) { return Optional.of(String.format("Task exceeded one or more memory limits (%s MB mem, %s MB disk).", task.get().getTaskRequest().getDeploy().getResources().get().getMemoryMb(), task.get().getTaskRequest().getDeploy().getResources().get().getDiskMb())); } else { return Optional.of(String.format("Task exceeded memory limit (%s MB mem).", task.get().getTaskRequest().getDeploy().getResources().get().getMemoryMb())); } } return Optional.of("Task exceeded memory limit."); } else if (status.hasReason() && status.getReason() == Reason.REASON_CONTAINER_LIMITATION_DISK) { if (task.isPresent() && task.get().getTaskRequest().getDeploy().getResources().isPresent()) { return Optional.of(String.format("Task exceeded disk limit (%s MB disk).", task.get().getTaskRequest().getDeploy().getResources().get().getDiskMb())); } else { return Optional.of("Task exceeded disk limit."); } } return Optional.absent(); }