diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-06-19 13:34:50 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-06-19 13:34:50 +0200 |
commit | 3285e02fd0d57ebd7f0f7990c2e6609c21ef76fc (patch) | |
tree | 25fc317932f41a5a31c6dc83458dc7cd87fc46b6 /controller-server | |
parent | cef7d5365d63e4d3a18f219b4615ae883fd8c2d7 (diff) |
Changed some types, added some doc
Diffstat (limited to 'controller-server')
6 files changed, 63 insertions, 18 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java index a6f87b3236d..3f5f3369c0a 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java @@ -64,6 +64,7 @@ public class Controller extends AbstractComponent { private final CuratorDb curator; private final ApplicationController applicationController; private final TenantController tenantController; + private final JobController jobController; private final Clock clock; private final GitHub gitHub; private final EntityService entityService; @@ -117,16 +118,15 @@ public class Controller extends AbstractComponent { this.clock = Objects.requireNonNull(clock, "Clock cannot be null"); this.athenzClientFactory = Objects.requireNonNull(athenzClientFactory, "AthenzClientFactory cannot be null"); - BuildService delegatingBuildService = new DelegatingBuildService(Objects.requireNonNull(buildService, "BuildService cannot be null"), - new InternalBuildService(new JobController(this))); - + jobController = new JobController(this); applicationController = new ApplicationController(this, curator, athenzClientFactory, Objects.requireNonNull(rotationsConfig, "RotationsConfig cannot be null"), Objects.requireNonNull(nameService, "NameService cannot be null"), configServer, Objects.requireNonNull(artifactRepository, "ArtifactRepository cannot be null"), Objects.requireNonNull(routingGenerator, "RoutingGenerator cannot be null"), - delegatingBuildService, + new DelegatingBuildService(Objects.requireNonNull(buildService, "BuildService cannot be null"), + new InternalBuildService(jobController)), clock); tenantController = new TenantController(this, curator, athenzClientFactory); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalBuildService.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalBuildService.java index c83c2ebb9e4..74dffc1c4fd 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalBuildService.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalBuildService.java @@ -4,6 +4,9 @@ import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; /** + * Wraps a JobController as a BuildService. + * + * Shall be inlined when the {@link DelegatingBuildService} delegates all jobs to it. * * @author jonmv */ diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java index fdbbc53ce21..2d1040f7095 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java @@ -2,11 +2,21 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.config.provision.ApplicationId; import com.yahoo.vespa.hosted.controller.Controller; -import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.integration.LogStore; +import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import java.util.List; +/** + * A singleton owned by the controller, which contains the state and methods for controlling deployment jobs. + * + * Keys are the {@link ApplicationId} of the real application, for which the deployment job is run, and the + * {@link ZoneId} of the real deployment to test. + * + * Although the deployment jobs are themselves applications, their IDs are not to be referenced. + * + * @author jonmv + */ public class JobController { private final Controller controller; @@ -30,12 +40,12 @@ public class JobController { } /** Returns all job types which have been run for the given application. */ - List<DeploymentId> jobs(ApplicationId application) { + List<ZoneId> jobs(ApplicationId application) { return null; } - /** Returns a list of meta information about all runs of the given type. */ - List<JobMeta> runs(DeploymentId deployment) { + /** Returns a list of meta information about all known runs of the given job type. */ + List<JobMeta> runs(ApplicationId application, ZoneId zone) { return null; } @@ -44,7 +54,7 @@ public class JobController { return null; } - /** Returns all details about the given job. */ + /** Returns the details for the given job. */ JobDetails details(JobId job) { return null; } @@ -57,7 +67,7 @@ public class JobController { } /** Orders a run of the given type, and returns the id of the created job. */ - JobId run(DeploymentId deployment) { + JobId run(ApplicationId application, ZoneId zone) { return null; } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobDetails.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobDetails.java index 239fde65031..3c787c8314f 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobDetails.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobDetails.java @@ -2,6 +2,11 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.vespa.hosted.controller.api.ActivateResult; +/** + * Contains details about a deployment job run. + * + * @author jonmv + */ public class JobDetails { private final ActivateResult deploymentResult; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobId.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobId.java index bfbb63eb2e9..541494a23fc 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobId.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobId.java @@ -1,6 +1,8 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import java.util.Objects; @@ -13,18 +15,18 @@ import java.util.Objects; public class JobId { private final ApplicationId application; - private final String type; + private final ZoneId zone; private final long number; - public JobId(ApplicationId application, String type, long number) { + public JobId(ApplicationId application, ZoneId zone, long number) { this.application = Objects.requireNonNull(application, "ApplicationId cannot be null!"); - this.type = Objects.requireNonNull(type, "JobType cannot be null!"); - if (number <= 0) throw new IllegalArgumentException("Build number must be a positive long integer!"); + this.zone = Objects.requireNonNull(zone, "ZoneId cannot be null!"); + if (number <= 0) throw new IllegalArgumentException("Build number must be a positive integer!"); this.number = number; } public ApplicationId application() { return application; } - public String type() { return type; } + public ZoneId zone() { return zone; } public long number() { return number; } @Override @@ -36,20 +38,20 @@ public class JobId { if (number != id.number) return false; if ( ! application.equals(id.application)) return false; - return type == id.type; + return zone == id.zone; } @Override public int hashCode() { int result = application.hashCode(); - result = 31 * result + type.hashCode(); + result = 31 * result + zone.hashCode(); result = 31 * result + (int) (number ^ (number >>> 32)); return result; } @Override public String toString() { - return "Run " + number + " of " + type + " for " + application; + return "Run " + number + " in " + zone + " for " + application; } } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobMeta.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobMeta.java index 5b5e7d301a1..dde675402ce 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobMeta.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobMeta.java @@ -1,7 +1,13 @@ package com.yahoo.vespa.hosted.controller.deployment; import java.time.Instant; +import java.util.Optional; +/** + * Contains state information for a deployment job run by an {@link InternalBuildService}. + * + * @author jonmv + */ public class JobMeta { private final JobId id; @@ -18,4 +24,23 @@ public class JobMeta { this.end = end; } + public JobId id() { + return id; + } + + public JobState state() { + return state; + } + + public JobOutcome outcome() { + return outcome; + } + + public Instant start() { + return start; + } + + public Optional<Instant> end() { + return Optional.ofNullable(end); + } } |