diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2022-08-16 09:20:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 09:20:36 +0200 |
commit | cf579cd8d957b1bb2992d7a86830fbca3a64f82b (patch) | |
tree | 9cbe4b82f360ea6ed9abb12ee90418efef3d5c87 /controller-api | |
parent | 02ec6bf9f89169f7bf8552f386da8671d1fbdff2 (diff) | |
parent | e7a01cc7055907cec8af4b4ffd38f7655b54c1ea (diff) |
Merge pull request #23663 from vespa-engine/jonmv/job-vespa-logs-in-S3
Jonmv/job vespa logs in s3
Diffstat (limited to 'controller-api')
2 files changed, 23 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java index 9cf508d37c9..3558d18f721 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java @@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.api.integration; import com.yahoo.config.provision.ApplicationId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; +import java.io.InputStream; import java.util.Optional; /** @@ -29,4 +30,10 @@ public interface RunDataStore { /** Deletes all data associated with the given application. */ void delete(ApplicationId id); + /** Stores Vespa logs for the run. */ + void putLogs(RunId id, boolean tester, InputStream logs); + + /** Fetches Vespa logs for the run. */ + InputStream getLogs(RunId id, boolean tester); + } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java index 32591cfe4e2..cc1e084de8e 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java @@ -5,10 +5,14 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.vespa.hosted.controller.api.integration.RunDataStore; import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; +import java.io.ByteArrayInputStream; +import java.io.InputStream; import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; +import static com.yahoo.yolean.Exceptions.uncheck; + /** * @author jonmv */ @@ -16,6 +20,8 @@ public class MockRunDataStore implements RunDataStore { private final Map<RunId, byte[]> logs = new ConcurrentHashMap<>(); private final Map<RunId, byte[]> reports = new ConcurrentHashMap<>(); + private final Map<RunId, byte[]> vespaLogs = new ConcurrentHashMap<>(); + private final Map<RunId, byte[]> testerLogs = new ConcurrentHashMap<>(); @Override public Optional<byte[]> get(RunId id) { @@ -49,4 +55,14 @@ public class MockRunDataStore implements RunDataStore { reports.keySet().removeIf(runId -> runId.application().equals(id)); } + @Override + public void putLogs(RunId id, boolean tester, InputStream logs) { + (tester ? testerLogs : vespaLogs).put(id, uncheck(logs::readAllBytes)); + } + + @Override + public InputStream getLogs(RunId id, boolean tester) { + return new ByteArrayInputStream((tester ? testerLogs : vespaLogs).get(id)); + } + } |