diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2020-09-08 09:30:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-08 09:30:38 +0200 |
commit | 5ca05d0121e19c67b7790206bb6b6968eaa232b2 (patch) | |
tree | a50fd094ba63655f076b698441e69ab1e8008d71 | |
parent | ce5821c363e11b49d66c798159c6611f21c4c149 (diff) | |
parent | 64ff77a3f8895c5c8a3508c0c2529f8a941165b7 (diff) |
Merge pull request #14318 from vespa-engine/jonmv/let-relevant-jobs-finish-when-rolling-out-new-application-change
Let relevant jobs finish when new application change rolls out
2 files changed, 19 insertions, 3 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java index 092143255d4..d39e0c134fd 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java @@ -102,9 +102,14 @@ public class DeploymentTrigger { instance = instance.withChange(instance.change().with(outstanding.application().get())); return instance.withChange(remainingChange(instance, status)); }); - for (Run run : jobs.active(application.get().id().instance(instanceName))) - if ( ! run.id().type().environment().isManuallyDeployed()) + + // Abort irrelevant, running jobs to get new application out faster. + Map<JobId, List<Versions>> newJobsToRun = jobs.deploymentStatus(application.get()).jobsToRun(); + for (Run run : jobs.active(application.get().id().instance(instanceName))) { + if ( ! run.id().type().environment().isManuallyDeployed() + && ! newJobsToRun.getOrDefault(run.id().job(), List.of()).contains(run.versions())) jobs.abort(run.id()); + } } } applications().store(application); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java index dd5e6edb5b8..f1306b51b39 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java @@ -1187,7 +1187,6 @@ public class DeploymentTriggerTest { assertNotEquals(build1, build2); // App now free to start system tests eagerly, for new submission. These should run assuming upgrade succeeds. - tester.outstandingChangeDeployer().run(); tester.triggerJobs(); app.assertRunning(stagingTest); assertEquals(version1, @@ -1203,6 +1202,18 @@ public class DeploymentTriggerTest { app.instanceJobs().get(stagingTest).lastTriggered().get().versions().targetPlatform()); assertEquals(build2, app.instanceJobs().get(stagingTest).lastTriggered().get().versions().targetApplication()); + + // App completes upgrade, and outstanding change is triggered. This should let relevant, running jobs finish. + app.runJob(systemTest) + .runJob(productionUsCentral1) + .runJob(productionUsEast3) + .runJob(productionUsWest1); + tester.outstandingChangeDeployer().run(); + + assertEquals(RunStatus.running, tester.jobs().last(app.instanceId(), stagingTest).get().status()); + app.runJob(stagingTest); + tester.triggerJobs(); + app.assertNotRunning(stagingTest); } } |