diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-04-30 13:53:34 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-04-30 13:53:34 +0200 |
commit | e1148e0a6b6b0ab4c4c4cb6f139ebc98ca0f037c (patch) | |
tree | 5de30ec361283e62c8e46fa7b510db8989cb0ad1 | |
parent | 6633988c2466a030d9751de49bb58c4a0a2e82b3 (diff) |
Include "pending" runs only for the relevant version >_<
3 files changed, 22 insertions, 41 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java index 55fbe1cc231..2cdfbcda571 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java @@ -22,6 +22,7 @@ import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; import com.yahoo.vespa.hosted.controller.deployment.DeploymentStatus; import com.yahoo.vespa.hosted.controller.deployment.Run; +import com.yahoo.vespa.hosted.controller.deployment.Versions; import com.yahoo.vespa.hosted.controller.restapi.application.EmptyResponse; import com.yahoo.vespa.hosted.controller.versions.DeploymentStatistics; import com.yahoo.vespa.hosted.controller.versions.VespaVersion; @@ -189,11 +190,15 @@ public class DeploymentApiHandler extends LoggingRequestHandler { jobStatus.coolingDownUntil(status.application().require(instance.instance()).change()) .ifPresent(until -> jobObject.setLong("coolingDownUntil", until.toEpochMilli())); if (jobsToRun.containsKey(job)) { - jobObject.setString("pending", jobsToRun.get(job).stream() - .allMatch(versions -> versions.sourcePlatform() - .map(versions.targetPlatform()::equals) - .orElse(true)) - ? "application" : "platform"); + List<Versions> versionsOnThisPlatform = jobsToRun.get(job).stream() + .filter(versions -> versions.targetPlatform().equals(statistics.version())) + .collect(Collectors.toList()); + if ( ! versionsOnThisPlatform.isEmpty()) + jobObject.setString("pending", versionsOnThisPlatform.stream() + .allMatch(versions -> versions.sourcePlatform() + .map(statistics.version()::equals) + .orElse(true)) + ? "application" : "platform"); } }); Cursor allRunsObject = instanceObject.setObject("allRuns"); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java index 6067322f2b6..dd2267be3a4 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java @@ -259,7 +259,7 @@ public class DeploymentContext { /** Trigger all outstanding jobs, if any */ public DeploymentContext triggerJobs() { - while (tester.controller().applications().deploymentTrigger().triggerReadyJobs() > 0); + tester.triggerJobs(); return this; } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json index 4f544427c4d..d0d79903da5 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json @@ -40,17 +40,14 @@ "jobs": [ { "name": "system-test", - "coolingDownUntil": "(ignore)", - "pending": "platform" + "coolingDownUntil": "(ignore)" }, { "name": "staging-test", - "coolingDownUntil": "(ignore)", - "pending": "platform" + "coolingDownUntil": "(ignore)" }, { - "name": "production-us-west-1", - "pending": "platform" + "name": "production-us-west-1" } ], "allRuns": { @@ -82,16 +79,13 @@ "upgradePolicy": "default", "jobs": [ { - "name": "system-test", - "pending": "platform" + "name": "system-test" }, { - "name": "staging-test", - "pending": "platform" + "name": "staging-test" }, { - "name": "production-us-west-1", - "pending": "platform" + "name": "production-us-west-1" } ], "allRuns": { @@ -279,11 +273,11 @@ { "name": "system-test", "coolingDownUntil": "(ignore)", - "pending": "application" + "pending": "platform" }, { "name": "staging-test", - "pending": "application" + "pending": "platform" }, { "name": "production-us-west-1", @@ -336,12 +330,10 @@ "upgradePolicy": "default", "jobs": [ { - "name": "system-test", - "pending": "platform" + "name": "system-test" }, { - "name": "staging-test", - "pending": "platform" + "name": "staging-test" }, { "name": "production-us-west-1", @@ -355,20 +347,6 @@ "start": "(ignore)", "status": "running" } - }, - "system-test": { - "running": { - "number": 1, - "start": "(ignore)", - "status": "running" - } - }, - "staging-test": { - "running": { - "number": 1, - "start": "(ignore)", - "status": "running" - } } }, "upgradeRuns": { @@ -378,9 +356,7 @@ "start": "(ignore)", "status": "running" } - }, - "system-test": {}, - "staging-test": {} + } } } ] |