summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2020-04-07 20:48:47 +0200
committerJon Marius Venstad <venstad@gmail.com>2020-04-07 20:48:47 +0200
commit7bae03fa21e90e67c64d46caf0ad1c3eaf2714d0 (patch)
tree316124bbebd318f646b205c08278b2b521953611 /controller-server
parent1cede6bf2388dfa45a0aed947fded75f4164396e (diff)
List jobs explicitly
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java14
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json380
3 files changed, 113 insertions, 284 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 b1706e044bd..ec1ff1ebc99 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
@@ -33,6 +33,7 @@ import java.util.stream.Stream;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.groupingBy;
+import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toUnmodifiableMap;
@@ -93,7 +94,7 @@ public class DeploymentApiHandler extends LoggingRequestHandler {
var versionStatus = controller.versionStatus();
var systemVersion = versionStatus.systemVersion().map(VespaVersion::versionNumber).orElse(Vtag.currentVersion);
var deploymentStatuses = controller.jobController().deploymentStatuses(ApplicationList.from(controller.applications().asList()), systemVersion);
- var deploymentStatistics = DeploymentStatistics.compute(versionStatus.versions().stream().map(VespaVersion::versionNumber).collect(Collectors.toList()),
+ var deploymentStatistics = DeploymentStatistics.compute(versionStatus.versions().stream().map(VespaVersion::versionNumber).collect(toList()),
deploymentStatuses)
.stream().collect(toMap(DeploymentStatistics::version, identity()));
for (VespaVersion version : versionStatus.versions()) {
@@ -155,7 +156,9 @@ public class DeploymentApiHandler extends LoggingRequestHandler {
.flatMap(identity())
.collect(Collectors.groupingBy(run -> run.run.id().application(),
LinkedHashMap::new, // Put apps with failing and running jobs first.
- groupingBy(run -> run.run.id().type())))
+ groupingBy(run -> run.run.id().type(),
+ LinkedHashMap::new,
+ toList())))
.forEach((instance, runs) -> {
Cursor instanceObject = instancesArray.addObject();
instanceObject.setString("tenant", instance.tenant().value());
@@ -168,17 +171,18 @@ public class DeploymentApiHandler extends LoggingRequestHandler {
.orElse(DeploymentSpec.UpgradePolicy.defaultPolicy)));
Cursor allJobsObject = instanceObject.setObject("allJobs");
Cursor upgradeJobsObject = instanceObject.setObject("upgradeJobs");
- for (JobType type : JobType.allIn(controller.system())) {
+ runs.forEach((type, rs) -> {
Cursor jobObject = allJobsObject.setObject(type.jobName());
Cursor upgradeObject = upgradeJobsObject.setObject(type.jobName());
- for (RunInfo run : runs.getOrDefault(type, List.of())) {
+ for (RunInfo run : rs) {
toSlime(jobObject, run.run);
if (run.upgrade)
toSlime(upgradeObject, run.run);
}
- }
+ });
});
}
+ JobType.allIn(controller.system()).stream().map(JobType::jobName).forEach(root.setArray("jobs")::addString);
return new SlimeJsonResponse(slime);
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
index 2118f221a79..c8036676fa9 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
@@ -69,6 +69,9 @@ public class DeploymentApiTest extends ControllerContainerTest {
deploymentTester.upgrader().maintain();
deploymentTester.triggerJobs();
+ // Application fails application change
+ productionApp.submit(multiInstancePackage).failDeployment(JobType.systemTest);
+
tester.controller().updateVersionStatus(censorConfigServers(VersionStatus.compute(tester.controller())));
tester.assertResponse(authenticatedRequest("http://localhost:8080/deployment/v1/"), new File("root.json"));
tester.assertResponse(authenticatedRequest("http://localhost:8080/api/deployment/v1/"), new File("root.json"));
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 88c9c5030cf..f44c3bce8a8 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
@@ -38,72 +38,24 @@
"productionJobCount": 1,
"upgradePolicy": "default",
"allJobs": {
- "system-test": {},
- "staging-test": {},
- "production-us-east-3": {},
- "test-us-east-3": {},
"production-us-west-1": {
"success": {
"number": 1,
- "start": 1586278617924,
- "end": 1586278617924,
+ "start": "(ignore)",
+ "end": "(ignore)",
"status": "success"
}
- },
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ }
},
"upgradeJobs": {
- "system-test": {},
- "staging-test": {},
- "production-us-east-3": {},
- "test-us-east-3": {},
"production-us-west-1": {
"success": {
"number": 1,
- "start": 1586278617924,
- "end": 1586278617924,
+ "start": "(ignore)",
+ "end": "(ignore)",
"status": "success"
}
- },
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ }
}
},
{
@@ -113,72 +65,24 @@
"productionJobCount": 1,
"upgradePolicy": "default",
"allJobs": {
- "system-test": {},
- "staging-test": {},
- "production-us-east-3": {},
- "test-us-east-3": {},
"production-us-west-1": {
"success": {
"number": 1,
- "start": 1586278617924,
- "end": 1586278617924,
+ "start": "(ignore)",
+ "end": "(ignore)",
"status": "success"
}
- },
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ }
},
"upgradeJobs": {
- "system-test": {},
- "staging-test": {},
- "production-us-east-3": {},
- "test-us-east-3": {},
"production-us-west-1": {
"success": {
"number": 1,
- "start": 1586278617924,
- "end": 1586278617924,
+ "start": "(ignore)",
+ "end": "(ignore)",
"status": "success"
}
- },
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ }
}
}
]
@@ -266,254 +170,172 @@
"system-test": {
"failing": {
"number": 2,
- "start": 1586278617924,
- "end": 1586278617924,
+ "start": "(ignore)",
+ "end": "(ignore)",
"status": "error"
},
"running": {
"number": 3,
- "start": 1586278617924,
+ "start": "(ignore)",
"status": "running"
}
},
"staging-test": {
"failing": {
"number": 2,
- "start": 1586278617924,
- "end": 1586278617924,
+ "start": "(ignore)",
+ "end": "(ignore)",
"status": "error"
},
"running": {
"number": 3,
- "start": 1586278617924,
+ "start": "(ignore)",
"status": "running"
}
- },
- "production-us-east-3": {},
- "test-us-east-3": {},
- "production-us-west-1": {},
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ }
},
"upgradeJobs": {
"system-test": {
"failing": {
"number": 2,
- "start": 1586278617924,
- "end": 1586278617924,
+ "start": "(ignore)",
+ "end": "(ignore)",
"status": "error"
},
"running": {
"number": 3,
- "start": 1586278617924,
+ "start": "(ignore)",
"status": "running"
}
},
"staging-test": {
"failing": {
"number": 2,
- "start": 1586278617924,
- "end": 1586278617924,
+ "start": "(ignore)",
+ "end": "(ignore)",
"status": "error"
},
"running": {
"number": 3,
- "start": 1586278617924,
+ "start": "(ignore)",
"status": "running"
}
- },
- "production-us-east-3": {},
- "test-us-east-3": {},
- "production-us-west-1": {},
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ }
}
},
{
"tenant": "tenant2",
"application": "application2",
- "instance": "i2",
+ "instance": "i1",
"productionJobCount": 1,
"upgradePolicy": "default",
"allJobs": {
- "system-test": {},
- "staging-test": {},
- "production-us-east-3": {},
- "test-us-east-3": {},
- "production-us-west-1": {
+ "system-test": {
+ "failing": {
+ "number": 3,
+ "start": "(ignore)",
+ "end": "(ignore)",
+ "status": "error"
+ }
+ },
+ "staging-test": {
"running": {
- "number": 2,
- "start": 1586278617924,
+ "number": 3,
+ "start": "(ignore)",
"status": "running"
}
},
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ "production-us-west-1": {
+ "success": {
+ "number": 2,
+ "start": "(ignore)",
+ "end": "(ignore)",
+ "status": "success"
+ }
+ }
},
"upgradeJobs": {
"system-test": {},
"staging-test": {},
- "production-us-east-3": {},
- "test-us-east-3": {},
"production-us-west-1": {
- "running": {
+ "success": {
"number": 2,
- "start": 1586278617924,
- "status": "running"
+ "start": "(ignore)",
+ "end": "(ignore)",
+ "status": "success"
}
- },
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ }
}
},
{
"tenant": "tenant2",
"application": "application2",
- "instance": "i1",
+ "instance": "i2",
"productionJobCount": 1,
"upgradePolicy": "default",
"allJobs": {
- "system-test": {},
- "staging-test": {},
- "production-us-east-3": {},
- "test-us-east-3": {},
"production-us-west-1": {
- "success": {
+ "running": {
"number": 2,
- "start": 1586278617924,
- "end": 1586278617924,
- "status": "success"
+ "start": "(ignore)",
+ "status": "running"
+ }
+ },
+ "system-test": {
+ "running": {
+ "number": 1,
+ "start": "(ignore)",
+ "status": "running"
}
},
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ "staging-test": {
+ "running": {
+ "number": 1,
+ "start": "(ignore)",
+ "status": "running"
+ }
+ }
},
"upgradeJobs": {
- "system-test": {},
- "staging-test": {},
- "production-us-east-3": {},
- "test-us-east-3": {},
"production-us-west-1": {
- "success": {
+ "running": {
"number": 2,
- "start": 1586278617924,
- "end": 1586278617924,
- "status": "success"
+ "start": "(ignore)",
+ "status": "running"
}
},
- "test-us-west-1": {},
- "production-us-central-1": {},
- "test-us-central-1": {},
- "production-ap-northeast-1": {},
- "test-ap-northeast-1": {},
- "production-ap-northeast-2": {},
- "test-ap-northeast-2": {},
- "production-ap-southeast-1": {},
- "test-ap-southeast-1": {},
- "production-eu-west-1": {},
- "test-eu-west-1": {},
- "production-aws-us-east-1a": {},
- "test-aws-us-east-1a": {},
- "production-aws-us-west-2a": {},
- "test-aws-us-west-2a": {},
- "production-aws-us-east-1b": {},
- "test-aws-us-east-1b": {},
- "dev-us-east-1": {},
- "dev-aws-us-east-2a": {},
- "perf-us-east-3": {}
+ "system-test": {},
+ "staging-test": {}
}
}
]
}
+ ],
+ "jobs": [
+ "system-test",
+ "staging-test",
+ "production-us-east-3",
+ "test-us-east-3",
+ "production-us-west-1",
+ "test-us-west-1",
+ "production-us-central-1",
+ "test-us-central-1",
+ "production-ap-northeast-1",
+ "test-ap-northeast-1",
+ "production-ap-northeast-2",
+ "test-ap-northeast-2",
+ "production-ap-southeast-1",
+ "test-ap-southeast-1",
+ "production-eu-west-1",
+ "test-eu-west-1",
+ "production-aws-us-east-1a",
+ "test-aws-us-east-1a",
+ "production-aws-us-west-2a",
+ "test-aws-us-west-2a",
+ "production-aws-us-east-1b",
+ "test-aws-us-east-1b",
+ "dev-us-east-1",
+ "dev-aws-us-east-2a",
+ "perf-us-east-3"
]
}