diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2018-10-31 17:53:46 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2018-10-31 17:53:46 +0100 |
commit | be0dde184b73e1ed9a27e577edade0290edf2e95 (patch) | |
tree | cbd8b4ccea0157942790d39b3e0989e23b175d98 /controller-server | |
parent | 62b5a975ba24347723c8d7e70f1ca34b6a7fc165 (diff) |
Address review
Diffstat (limited to 'controller-server')
3 files changed, 9 insertions, 7 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java index e6e1bfd9c14..2f56f2d9dd5 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java @@ -77,8 +77,8 @@ public class ApplicationList { return notUpgradingTo(version.get()); } - /** Returns the subset of applications which have unfinished changes */ - public ApplicationList deploying() { + /** Returns the subset of applications which have changes left to deploy; blocked, or deploying */ + public ApplicationList withChanges() { return listOf(list.stream().filter(application -> application.change().isPresent() || application.outstandingChange().isPresent())); } 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 cbd241e5df0..aeb9e6fa453 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 @@ -276,7 +276,7 @@ public class DeploymentTrigger { private List<Job> computeReadyJobs() { return ApplicationList.from(applications().asList()) .withProjectId() - .deploying() + .withChanges() .idList().stream() .map(this::computeReadyJobs) .flatMap(Collection::stream) @@ -301,7 +301,7 @@ public class DeploymentTrigger { if (change.isPresent()) { for (Step step : steps.production()) { List<JobType> stepJobs = steps.toJobs(step); - List<JobType> remainingJobs = stepJobs.stream().filter(job -> !isComplete(change, application, job)).collect(toList()); + List<JobType> remainingJobs = stepJobs.stream().filter(job -> ! isComplete(change, application, job)).collect(toList()); if (!remainingJobs.isEmpty()) { // Change is incomplete; trigger remaining jobs if ready, or their test jobs if untested. for (JobType job : remainingJobs) { Versions versions = Versions.from(change, application, deploymentFor(application, job), @@ -337,9 +337,9 @@ public class DeploymentTrigger { } } if (testJobs == null) { // If nothing to test, but outstanding commits, test those. - Change latestChange = application.outstandingChange().application() - .map(application.change()::with) - .orElse(application.change()); + Change latestChange = application.outstandingChange().application().isPresent() + ? change.with(application.outstandingChange().application().get()) + : change; testJobs = testJobs(application, Versions.from(latestChange, application, steps.sortedDeployments(application.productionDeployments().values()).stream().findFirst(), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java index a61d6bee91a..b87458e6ecf 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java @@ -6,7 +6,9 @@ import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.SystemName; import com.yahoo.slime.ArrayTraverser; +import com.yahoo.slime.Cursor; import com.yahoo.slime.Inspector; +import com.yahoo.slime.Slime; import com.yahoo.vespa.config.SlimeUtils; import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ConfigChangeActions; import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RefeedAction; |