diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-09-10 15:21:43 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-09-10 15:21:43 +0200 |
commit | 10cc1a0232d7f09116fb9eeaaa646c67ce3c29d5 (patch) | |
tree | 8d922b444f6d064f09b7ea40dbe583a2fc2e9a0e /hosted-api | |
parent | 8aed64b0c2e9fd6e37114c42bee64b512f73bef1 (diff) |
Reflect deployment job status when plugin exists
Diffstat (limited to 'hosted-api')
3 files changed, 34 insertions, 3 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java index bcbcb99587d..c6c5c64bd9f 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java @@ -304,6 +304,7 @@ public abstract class ControllerHttpClient { })); return new DeploymentLog(entries, rootObject.field("active").asBool(), + valueOf(rootObject.field("status").asString()), rootObject.field("lastId").valid() ? OptionalLong.of(rootObject.field("lastId").asLong()) : OptionalLong.empty()); } @@ -367,4 +368,18 @@ public abstract class ControllerHttpClient { } + private static DeploymentLog.Status valueOf(String status) { + switch (status) { + case "running": return DeploymentLog.Status.running; + case "aborted": return DeploymentLog.Status.aborted; + case "error": return DeploymentLog.Status.error; + case "testFailure": return DeploymentLog.Status.testFailure; + case "outOfCapacity": return DeploymentLog.Status.outOfCapacity; + case "installationFailed": return DeploymentLog.Status.installationFailed; + case "deploymentFailed": return DeploymentLog.Status.deploymentFailed; + case "success": return DeploymentLog.Status.success; + default: throw new IllegalArgumentException("Unexpected status '" + status + "'"); + } + } + } diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java index f2da64e9403..a42072fffd8 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java @@ -16,11 +16,13 @@ public class DeploymentLog { private final List<Entry> entries; private final boolean active; + private final Status status; private final OptionalLong last; - public DeploymentLog(List<Entry> entries, boolean active, OptionalLong last) { + public DeploymentLog(List<Entry> entries, boolean active, Status status, OptionalLong last) { this.entries = entries.stream().sorted(comparing(Entry::at)).collect(toUnmodifiableList()); this.active = active; + this.status = status; this.last = last; } @@ -32,6 +34,10 @@ public class DeploymentLog { return active; } + public Status status() { + return status; + } + public OptionalLong last() { return last; } @@ -63,4 +69,16 @@ public class DeploymentLog { } + + public enum Status { + running, + aborted, + error, + testFailure, + outOfCapacity, + installationFailed, + deploymentFailed, + success; + } + } diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentResult.java b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentResult.java index e78a7e926b4..34ce04b95fd 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentResult.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentResult.java @@ -1,8 +1,6 @@ package ai.vespa.hosted.api; -import java.net.URI; - /** * Contains information about the result of a {@link Deployment} against a {@link ControllerHttpClient}. * |