diff options
author | jonmv <venstad@gmail.com> | 2023-05-03 16:06:42 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2023-05-03 16:06:42 +0200 |
commit | 5771cbf3e8fa5fff5cf17b68d3809bed7622a995 (patch) | |
tree | a3cdedb443ccad30269acd154be3a19b339bc73d /controller-server | |
parent | 4ba798e5e6ccd9ccd729ed62af0f7a4c2869ba3a (diff) |
Avoid delay-cause also when the only job to run is ... running!
Diffstat (limited to 'controller-server')
3 files changed, 54 insertions, 50 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 956e7e755e5..2ab42897a3e 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 @@ -292,20 +292,6 @@ class JobControllerApiHandlerHelper { } } } - stepObject.setString("delayCause", - stepStatus.job().isPresent() && ! jobsToRun.containsKey(stepStatus.job().get()) - ? (String) null - : switch (readiness.cause()) { - case none -> null; - case invalidPackage -> "invalidPackage"; - case paused -> "paused"; - case coolingDown -> "coolingDown"; - case changeBlocked -> "changeBlocked"; - case blocked -> "blocked"; - case running -> "running"; - case notReady -> "notReady"; - case unverified -> "unverified"; - }); if (stepStatus.type() == DeploymentStatus.StepType.delay) stepStatus.completedAt(change).ifPresent(completed -> stepObject.setLong("completedAt", completed.toEpochMilli())); @@ -365,7 +351,9 @@ class JobControllerApiHandlerHelper { } } - stepStatus.job().ifPresent(job -> { + boolean showDelayCause = true; + if (stepStatus.job().isPresent()) { + JobId job = stepStatus.job().get(); stepObject.setString("jobName", job.type().jobName()); URI baseUriForJob = baseUriForDeployments.resolve(baseUriForDeployments.getPath() + "/../instance/" + job.application().instance().value() + @@ -383,6 +371,7 @@ class JobControllerApiHandlerHelper { JobStatus jobStatus = status.jobs().get(job).get(); Cursor toRunArray = stepObject.setArray("toRun"); + showDelayCause = false; for (DeploymentStatus.Job versions : jobsToRun.getOrDefault(job, List.of())) { boolean running = jobStatus.lastTriggered() .map(run -> jobStatus.isRunning() @@ -392,12 +381,27 @@ class JobControllerApiHandlerHelper { if (running) continue; // Run will be contained in the "runs" array. + showDelayCause = true; Cursor runObject = toRunArray.addObject(); toSlime(runObject.setObject("versions"), versions.versions(), application); } toSlime(stepObject.setArray("runs"), jobStatus.runs().descendingMap().values(), application, 10, baseUriForJob); - }); + } + stepObject.setString("delayCause", + ! showDelayCause + ? (String) null + : switch (readiness.cause()) { + case none -> null; + case invalidPackage -> "invalidPackage"; + case paused -> "paused"; + case coolingDown -> "coolingDown"; + case changeBlocked -> "changeBlocked"; + case blocked -> "blocked"; + case running -> "running"; + case notReady -> "notReady"; + case unverified -> "unverified"; + }); } Cursor buildsArray = responseObject.setArray("builds"); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json index 6793553faca..b103b579166 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json @@ -9,7 +9,6 @@ "declared": true, "instance": "default", "readyAt": 0, - "delayCause": null, "deploying": { "application": { "build": 3, @@ -148,7 +147,8 @@ } ] } - } + }, + "delayCause": null }, { "type": "test", @@ -156,7 +156,6 @@ "declared": false, "instance": "default", "readyAt": 0, - "delayCause": null, "jobName": "system-test", "url": "https://some.url:43/instance/default/job/system-test", "environment": "test", @@ -336,7 +335,8 @@ } ] } - ] + ], + "delayCause": null }, { "type": "test", @@ -346,7 +346,6 @@ "readyAt": 15153000, "delayedUntil": 15153000, "coolingDownUntil": 15153000, - "delayCause": "coolingDown", "jobName": "staging-test", "url": "https://some.url:43/instance/default/job/staging-test", "environment": "staging", @@ -769,7 +768,8 @@ } ] } - ] + ], + "delayCause": "coolingDown" }, { "type": "deployment", @@ -781,7 +781,6 @@ "instance": "default", "readyAt": 14403000, "delayedUntil": 14403000, - "delayCause": "running", "jobName": "production-us-central-1", "url": "https://some.url:43/instance/default/job/production-us-central-1", "environment": "prod", @@ -898,7 +897,8 @@ } ] } - ] + ], + "delayCause": null }, { "type": "test", @@ -907,7 +907,6 @@ ], "declared": true, "instance": "default", - "delayCause": "notReady", "jobName": "test-us-central-1", "url": "https://some.url:43/instance/default/job/test-us-central-1", "environment": "prod", @@ -1039,7 +1038,8 @@ } ] } - ] + ], + "delayCause": "notReady" }, { "type": "deployment", @@ -1048,7 +1048,6 @@ ], "declared": true, "instance": "default", - "delayCause": "notReady", "jobName": "production-us-west-1", "url": "https://some.url:43/instance/default/job/production-us-west-1", "environment": "prod", @@ -1148,7 +1147,8 @@ } ] } - ] + ], + "delayCause": "notReady" }, { "type": "deployment", @@ -1157,7 +1157,6 @@ ], "declared": true, "instance": "default", - "delayCause": "notReady", "jobName": "production-us-east-3", "url": "https://some.url:43/instance/default/job/production-us-east-3", "environment": "prod", @@ -1257,7 +1256,8 @@ } ] } - ] + ], + "delayCause": "notReady" } ], "builds": [ diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json index 0b7c64c72a5..500f66a7cdb 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json @@ -9,7 +9,6 @@ "declared": true, "instance": "instance1", "readyAt": 0, - "delayCause": null, "deploying": { "application": { "build": 4, @@ -60,7 +59,8 @@ ], "blockers": [ ] } - } + }, + "delayCause": null }, { "type": "test", @@ -69,7 +69,6 @@ "instance": "instance1", "readyAt": 0, "delayedUntil": 0, - "delayCause": "running", "jobName": "system-test", "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/system-test", "environment": "test", @@ -190,7 +189,8 @@ } ] } - ] + ], + "delayCause": null }, { "type": "test", @@ -199,7 +199,6 @@ "instance": "instance1", "readyAt": 0, "delayedUntil": 0, - "delayCause": "running", "jobName": "staging-test", "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/staging-test", "environment": "staging", @@ -352,7 +351,8 @@ } ] } - ] + ], + "delayCause": null }, { "type": "deployment", @@ -361,7 +361,6 @@ ], "declared": true, "instance": "instance1", - "delayCause": "unverified", "jobName": "production-us-central-1", "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/production-us-central-1", "environment": "prod", @@ -410,7 +409,8 @@ } ] } - ] + ], + "delayCause": "unverified" }, { "type": "deployment", @@ -419,7 +419,6 @@ ], "declared": true, "instance": "instance1", - "delayCause": "notReady", "jobName": "production-us-west-1", "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/production-us-west-1", "environment": "prod", @@ -468,7 +467,8 @@ } ] } - ] + ], + "delayCause": "notReady" }, { "type": "deployment", @@ -477,7 +477,6 @@ ], "declared": true, "instance": "instance1", - "delayCause": "notReady", "jobName": "production-us-east-3", "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/production-us-east-3", "environment": "prod", @@ -553,7 +552,8 @@ } ] } - ] + ], + "delayCause": "notReady" }, { "type": "instance", @@ -563,7 +563,6 @@ ], "declared": true, "instance": "instance2", - "delayCause": "notReady", "deploying": { "application": { "build": 4, @@ -614,7 +613,8 @@ ], "blockers": [ ] } - } + }, + "delayCause": "notReady" }, { "type": "deployment", @@ -623,7 +623,6 @@ ], "declared": true, "instance": "instance2", - "delayCause": "unverified", "jobName": "production-us-central-1", "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance2/job/production-us-central-1", "environment": "prod", @@ -641,7 +640,8 @@ } } ], - "runs": [ ] + "runs": [ ], + "delayCause": "unverified" }, { "type": "deployment", @@ -650,7 +650,6 @@ ], "declared": true, "instance": "instance2", - "delayCause": "notReady", "jobName": "production-us-west-1", "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance2/job/production-us-west-1", "environment": "prod", @@ -668,7 +667,8 @@ } } ], - "runs": [ ] + "runs": [ ], + "delayCause": "notReady" }, { "type": "deployment", @@ -677,7 +677,6 @@ ], "declared": true, "instance": "instance2", - "delayCause": "notReady", "jobName": "production-us-east-3", "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance2/job/production-us-east-3", "environment": "prod", @@ -695,7 +694,8 @@ } } ], - "runs": [ ] + "runs": [ ], + "delayCause": "notReady" } ], "builds": [ |