private SingularityDeployResult checkOverdue(SingularityRequest request, Optional<SingularityDeploy> deploy, SingularityPendingDeploy pendingDeploy, Collection<SingularityTaskId> deployActiveTasks, boolean isOverdue) { String message = null; if (deploy.isPresent()) { message = String.format("Deploy was able to launch %s tasks, but not all of them became healthy within %s", deployActiveTasks.size(), JavaUtils.durationFromMillis(getAllowedMillis(deploy.get()))); } if (deploy.isPresent() && isOverdue) { return getDeployResultWithFailures(request, deploy, pendingDeploy, DeployState.OVERDUE, message, deployActiveTasks); } else { return new SingularityDeployResult(DeployState.WAITING); } }
private boolean isDeployOverdue(SingularityPendingDeploy pendingDeploy, Optional<SingularityDeploy> deploy) { if (!deploy.isPresent()) { LOG.warn("Can't determine if deploy {} is overdue because it was missing", pendingDeploy); return false; } if (pendingDeploy.getDeployProgress().isPresent() && pendingDeploy.getDeployProgress().get().isStepComplete()) { return false; } final long startTime = getStartTime(pendingDeploy); final long deployDuration = System.currentTimeMillis() - startTime; final long allowedTime = getAllowedMillis(deploy.get()); if (deployDuration > allowedTime) { LOG.warn("Deploy {} is overdue (duration: {}), allowed: {}", pendingDeploy, DurationFormatUtils.formatDurationHMS(deployDuration), DurationFormatUtils.formatDurationHMS(allowedTime)); return true; } else { LOG.trace("Deploy {} is not yet overdue (duration: {}), allowed: {}", pendingDeploy, DurationFormatUtils.formatDurationHMS(deployDuration), DurationFormatUtils.formatDurationHMS(allowedTime)); return false; } }
private SingularityDeployResult checkOverdue(SingularityRequest request, Optional<SingularityDeploy> deploy, SingularityPendingDeploy pendingDeploy, Collection<SingularityTaskId> deployActiveTasks, boolean isOverdue) { String message = null; if (deploy.isPresent()) { message = String.format("Deploy was able to launch %s tasks, but not all of them became healthy within %s", deployActiveTasks.size(), JavaUtils.durationFromMillis(getAllowedMillis(deploy.get()))); } if (deploy.isPresent() && isOverdue) { return getDeployResultWithFailures(request, deploy, pendingDeploy, DeployState.OVERDUE, message, deployActiveTasks); } else { return new SingularityDeployResult(DeployState.WAITING); } }
private boolean isDeployOverdue(SingularityPendingDeploy pendingDeploy, Optional<SingularityDeploy> deploy) { if (!deploy.isPresent()) { LOG.warn("Can't determine if deploy {} is overdue because it was missing", pendingDeploy); return false; } if (pendingDeploy.getDeployProgress().isPresent() && pendingDeploy.getDeployProgress().get().isStepComplete()) { return false; } final long startTime = getStartTime(pendingDeploy); final long deployDuration = System.currentTimeMillis() - startTime; final long allowedTime = getAllowedMillis(deploy.get()); if (deployDuration > allowedTime) { LOG.warn("Deploy {} is overdue (duration: {}), allowed: {}", pendingDeploy, DurationFormatUtils.formatDurationHMS(deployDuration), DurationFormatUtils.formatDurationHMS(allowedTime)); return true; } else { LOG.trace("Deploy {} is not yet overdue (duration: {}), allowed: {}", pendingDeploy, DurationFormatUtils.formatDurationHMS(deployDuration), DurationFormatUtils.formatDurationHMS(allowedTime)); return false; } }