aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2017-11-02 06:38:48 +0100
committerJon Marius Venstad <venstad@gmail.com>2017-11-02 06:38:48 +0100
commit90e9abe14815fb0d36415d2ab7aceca0f0335487 (patch)
tree0b8aaf654e3d31f48cd15d883c00dea480485cf6 /controller-server
parent405bd2337aa06c52262659a3e9ed8e41cdb4a93b (diff)
Unfinished
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/DeploymentStatistics.java20
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java20
3 files changed, 37 insertions, 9 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 8a5f1e4639a..b0f2500614e 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
@@ -101,7 +101,6 @@ public class DeploymentApiHandler extends LoggingRequestHandler {
Cursor applicationObject = failingArray.addObject();
toSlime(application.get(), applicationObject, request);
applicationObject.setLong("failingSince", failingSince.toEpochMilli());
-
}
Cursor productionArray = versionObject.setArray("productionApplications");
@@ -110,6 +109,11 @@ public class DeploymentApiHandler extends LoggingRequestHandler {
if ( ! application.isPresent()) continue; // deleted just now
toSlime(application.get(), productionArray.addObject(), request);
}
+
+ Cursor deployingArray = versionObject.setArray("deployingApplications");
+ for (ApplicationId id : version.statistics().deploying()) {
+
+ }
}
return new SlimeJsonResponse(slime);
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/DeploymentStatistics.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/DeploymentStatistics.java
index 6174a017a54..b2ec8c5e269 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/DeploymentStatistics.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/DeploymentStatistics.java
@@ -18,18 +18,20 @@ public class DeploymentStatistics {
private final Version version;
private final ImmutableList<ApplicationId> failing;
private final ImmutableList<ApplicationId> production;
+ private final ImmutableList<ApplicationId> deploying;
/** DO NOT USE. Public for serialization purposes */
public DeploymentStatistics(Version version, List<ApplicationId> failingApplications,
- List<ApplicationId> production) {
+ List<ApplicationId> production, List<ApplicationId> deploying) {
this.version = version;
this.failing = ImmutableList.copyOf(failingApplications);
this.production = ImmutableList.copyOf(production);
+ this.deploying = ImmutableList.copyOf(deploying);
}
/** Returns a statistics instance with the values as 0 */
public static DeploymentStatistics empty(Version version) {
- return new DeploymentStatistics(version, ImmutableList.of(), ImmutableList.of());
+ return new DeploymentStatistics(version, ImmutableList.of(), ImmutableList.of(), ImmutableList.of());
}
/** Returns the version these statistics are for */
@@ -43,15 +45,23 @@ public class DeploymentStatistics {
/** Returns the applications which have this version in production in at least one zone */
public List<ApplicationId> production() { return production; }
-
+
+ /** Returns the applications which are currently upgrading to this version */
+ public List<ApplicationId> deploying() { return deploying; }
+
/** Returns a version of this with the given failing application added */
public DeploymentStatistics withFailing(ApplicationId application) {
- return new DeploymentStatistics(version, add(application, failing), production);
+ return new DeploymentStatistics(version, add(application, failing), production, deploying);
}
/** Returns a version of this with the given production application added */
public DeploymentStatistics withProduction(ApplicationId application) {
- return new DeploymentStatistics(version, failing, add(application, production));
+ return new DeploymentStatistics(version, failing, add(application, production), deploying);
+ }
+
+ /** Returns a version of this with the given deploying application added */
+ public DeploymentStatistics withDeploying(ApplicationId application) {
+ return new DeploymentStatistics(version, failing, production, add(application, deploying));
}
private ImmutableList<ApplicationId> add(ApplicationId application, ImmutableList<ApplicationId> list) {
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java
index 73e4eb4d527..07933a3c9e0 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java
@@ -11,7 +11,9 @@ import com.yahoo.vespa.hosted.controller.api.integration.github.GitSha;
import com.yahoo.vespa.hosted.controller.application.ApplicationList;
import com.yahoo.vespa.hosted.controller.application.Deployment;
import com.yahoo.vespa.hosted.controller.application.DeploymentJobs;
+import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType;
import com.yahoo.vespa.hosted.controller.application.JobStatus;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentTrigger;
import java.net.URI;
import java.time.Instant;
@@ -92,7 +94,8 @@ public class VersionStatus {
Version systemVersion = infrastructureVersions.stream().sorted().findFirst().get();
Collection<DeploymentStatistics> deploymentStatistics = computeDeploymentStatistics(infrastructureVersions,
- controller.applications().asList());
+ controller.applications().asList(),
+ controller.applications().deploymentTrigger().jobTimeoutLimit());
List<VespaVersion> versions = new ArrayList<>();
for (DeploymentStatistics statistics : deploymentStatistics) {
@@ -126,7 +129,8 @@ public class VersionStatus {
}
private static Collection<DeploymentStatistics> computeDeploymentStatistics(Set<Version> infrastructureVersions,
- List<Application> applications) {
+ List<Application> applications,
+ Instant jobTimeoutLimit) {
Map<Version, DeploymentStatistics> versionMap = new HashMap<>();
for (Version infrastructureVersion : infrastructureVersions) {
@@ -142,7 +146,7 @@ public class VersionStatus {
versionMap.computeIfAbsent(deployment.version(), DeploymentStatistics::empty);
}
- // List versions which have failing jobs, and versions which are in production
+ // List versions which have failing jobs, versions which are in production, and versions to which applications are deploying
// Failing versions
Map<Version, List<JobStatus>> failingJobsByVersion = jobs.jobStatus().values().stream()
@@ -163,6 +167,16 @@ public class VersionStatus {
for (Version v : succeedingJobsByVersions.keySet()) {
versionMap.compute(v, (version, statistics) -> emptyIfMissing(version, statistics).withProduction(application.id()));
}
+
+ // Deploying versions
+ Map<Version, List<JobStatus>> deployingJobsByVersion = jobs.jobStatus().values().stream()
+ .filter(jobStatus -> jobStatus.isRunning(jobTimeoutLimit))
+ .filter(jobStatus -> jobStatus.type() != JobType.component)
+ .filter(jobStatus -> jobStatus.lastTriggered().isPresent())
+ .collect(Collectors.groupingBy(jobStatus -> jobStatus.lastTriggered().get().version())); // Plain wrong for component jobs ...
+ for (Version v : deployingJobsByVersion.keySet()) {
+ versionMap.compute(v, (version, statistics) -> emptyIfMissing(version, statistics).withDeploying(application.id()));
+ }
}
return versionMap.values();
}