private boolean isRunningTaskHealthy(final Optional<SingularityDeploy> deploy, Collection<SingularityTaskHistoryUpdate> updates, SingularityTaskId taskId) { long runningThreshold = configuration.getConsiderTaskHealthyAfterRunningForSeconds(); if (deploy.isPresent()) { runningThreshold = deploy.get().getConsiderHealthyAfterRunningForSeconds().or(runningThreshold); } if (runningThreshold < 1) { return true; } Optional<SingularityTaskHistoryUpdate> runningUpdate = SingularityTaskHistoryUpdate.getUpdate(updates, ExtendedTaskState.TASK_RUNNING); long taskDuration = System.currentTimeMillis() - runningUpdate.get().getTimestamp(); long runningThresholdMillis = TimeUnit.SECONDS.toMillis(runningThreshold); if (taskDuration < runningThresholdMillis) { LOG.debug("Task {} has been running for {}, has not yet reached running threshold of {}", taskId, JavaUtils.durationFromMillis(taskDuration), JavaUtils.durationFromMillis(runningThresholdMillis)); return false; } return true; }
private Optional<SingularityEmailType> getEmailType(ExtendedTaskState taskState, SingularityRequest request, Collection<SingularityTaskHistoryUpdate> taskHistory) { final Optional<SingularityTaskHistoryUpdate> cleaningUpdate = SingularityTaskHistoryUpdate.getUpdate(taskHistory, ExtendedTaskState.TASK_CLEANING);
if (SingularityTaskHistoryUpdate.getUpdate(taskManager.getTaskHistoryUpdates(taskId), ExtendedTaskState.TASK_CLEANING).isPresent()) { LOG.debug("{} failed with {} after cleaning - ignoring it for cooldown", taskId, state); } else {
private boolean isRunningTaskHealthy(final Optional<SingularityDeploy> deploy, Collection<SingularityTaskHistoryUpdate> updates, SingularityTaskId taskId) { long runningThreshold = configuration.getConsiderTaskHealthyAfterRunningForSeconds(); if (deploy.isPresent()) { runningThreshold = deploy.get().getConsiderHealthyAfterRunningForSeconds().or(runningThreshold); } if (runningThreshold < 1) { return true; } Optional<SingularityTaskHistoryUpdate> runningUpdate = SingularityTaskHistoryUpdate.getUpdate(updates, ExtendedTaskState.TASK_RUNNING); long taskDuration = System.currentTimeMillis() - runningUpdate.get().getTimestamp(); long runningThresholdMillis = TimeUnit.SECONDS.toMillis(runningThreshold); if (taskDuration < runningThresholdMillis) { LOG.debug("Task {} has been running for {}, has not yet reached running threshold of {}", taskId, JavaUtils.durationFromMillis(taskDuration), JavaUtils.durationFromMillis(runningThresholdMillis)); return false; } return true; }
private Optional<SingularityEmailType> getEmailType(ExtendedTaskState taskState, SingularityRequest request, Collection<SingularityTaskHistoryUpdate> taskHistory) { final Optional<SingularityTaskHistoryUpdate> cleaningUpdate = SingularityTaskHistoryUpdate.getUpdate(taskHistory, ExtendedTaskState.TASK_CLEANING);
if (SingularityTaskHistoryUpdate.getUpdate(taskManager.getTaskHistoryUpdates(taskId), ExtendedTaskState.TASK_CLEANING).isPresent()) { LOG.debug("{} failed with {} after cleaning - ignoring it for cooldown", taskId, state); } else {