diff options
author | jonmv <venstad@gmail.com> | 2023-05-03 22:37:54 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2023-05-03 22:37:54 +0200 |
commit | f76c53cf13d1addeea63a18c1dbd6fb51af00b3a (patch) | |
tree | a519d8d469477e8b873cd791a51b5e0cc9c68c8a /controller-server | |
parent | 5771cbf3e8fa5fff5cf17b68d3809bed7622a995 (diff) |
Restore pausedUntil
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java index 2ab42897a3e..2fc5ac10e6b 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java @@ -273,25 +273,19 @@ class JobControllerApiHandlerHelper { // TODO: recursively search dependents for what is the relevant partial change when this is a delay step ... Readiness readiness = stepStatus.job().map(jobsToRun::get).map(job -> job.get(0).readiness()) .orElse(stepStatus.readiness(change)); + Instant now = controller.clock().instant(); if (readiness.ok()) { stepObject.setLong("readyAt", readiness.at().toEpochMilli()); - if ( ! readiness.okAt(controller.clock().instant())) { - Instant until = readiness.at(); - stepObject.setLong("delayedUntil", readiness.at().toEpochMilli()); - switch (readiness.cause()) { - case paused -> stepObject.setLong("pausedUntil", until.toEpochMilli()); - case coolingDown -> stepObject.setLong("coolingDownUntil", until.toEpochMilli()); - case changeBlocked -> { - Readiness platformReadiness = stepStatus.readiness(Change.of(controller.systemVersion(versionStatus))); // Dummy version — just anything with a platform. - if (platformReadiness.cause() == DelayCause.changeBlocked) - stepObject.setLong("platformBlockedUntil", platformReadiness.at().toEpochMilli()); - Readiness applicationReadiness = stepStatus.readiness(Change.of(RevisionId.forProduction(1))); // Dummy version — just anything with an application. - if (applicationReadiness.cause() == DelayCause.changeBlocked) - stepObject.setLong("applicationBlockedUntil", applicationReadiness.at().toEpochMilli()); - } - } - } + if ( ! readiness.okAt(now)) stepObject.setLong("delayedUntil", readiness.at().toEpochMilli()); } + if (readiness.cause() == DelayCause.coolingDown) stepObject.setLong("coolingDownUntil", readiness.at().toEpochMilli()); + if ( ! stepStatus.pausedUntil().okAt(now)) stepObject.setLong("pausedUntil", stepStatus.pausedUntil().at().toEpochMilli()); + Readiness platformReadiness = stepStatus.blockedUntil(Change.of(controller.systemVersion(versionStatus))); // Dummy version — just anything with a platform. + if ( ! platformReadiness.okAt(now)) + stepObject.setLong("platformBlockedUntil", platformReadiness.at().toEpochMilli()); + Readiness applicationReadiness = stepStatus.blockedUntil(Change.of(RevisionId.forProduction(1))); // Dummy version — just anything with an application. + if ( ! applicationReadiness.okAt(now)) + stepObject.setLong("applicationBlockedUntil", applicationReadiness.at().toEpochMilli()); if (stepStatus.type() == DeploymentStatus.StepType.delay) stepStatus.completedAt(change).ifPresent(completed -> stepObject.setLong("completedAt", completed.toEpochMilli())); |