diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-11-11 08:21:51 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-11-11 08:21:51 +0100 |
commit | 3838685d7c27ab1fd1cee58dfc04a2a227774add (patch) | |
tree | 8247cf81610f935c0ced89351cc93108bde90e7f /controller-server | |
parent | f4ba2204def1f4112befb9ce0e25ccf7591261f9 (diff) |
Pick a deterministic job when there are ties for time of start
Diffstat (limited to 'controller-server')
2 files changed, 7 insertions, 3 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 4ac7ff4d6d4..46f4b2816c1 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 @@ -23,6 +23,8 @@ import com.yahoo.vespa.hosted.controller.restapi.application.EmptyResponse; import com.yahoo.vespa.hosted.controller.versions.VespaVersion; import com.yahoo.yolean.Exceptions; +import java.time.Instant; +import java.util.Comparator; import java.util.Optional; import java.util.logging.Level; @@ -162,7 +164,8 @@ public class DeploymentApiHandler extends LoggingRequestHandler { .not().failingBecause(outOfCapacity) .lastCompleted().on(version) .asList().stream() - .min(comparing(job -> job.lastCompleted().get().at())); + .min(Comparator.<JobStatus, Instant>comparing(job -> job.lastCompleted().get().at()) + .thenComparing(job -> job.type())); } /** The number of production jobs for this application */ @@ -186,7 +189,8 @@ public class DeploymentApiHandler extends LoggingRequestHandler { .upgrading() .lastTriggered().on(version) .asList().stream() - .max(comparing(job -> job.lastTriggered().get().at())); + .max(Comparator.<JobStatus, Instant>comparing(job -> job.lastCompleted().get().at()) + .thenComparing(job -> job.type())); } } 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 fb445ac600a..ca5424696d2 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 @@ -82,7 +82,7 @@ "instance": "i2", "url": "http://localhost:8080/application/v4/tenant/tenant2/application/application2", "upgradePolicy": "default", - "running": "system-test" + "running": "staging-test" } ] } |