From 11e355321db20b70c76c35b6e8fc36dbb9d97fc6 Mon Sep 17 00:00:00 2001 From: vincent van beek Date: Wed, 15 Apr 2026 16:19:02 +0200 Subject: add a job report to the scenario overview with details and time data (#406) * add a job report to the scenario overview with details and time data * create Report data class --- .../main/java/org/opendc/web/proto/runner/Job.java | 4 +- .../java/org/opendc/web/proto/runner/Report.java | 51 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Report.java (limited to 'opendc-web/opendc-web-proto') diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Job.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Job.java index 587fe451..c8ec8d92 100644 --- a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Job.java +++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Job.java @@ -36,6 +36,7 @@ public record Job( Scenario scenario, JobState state, Instant createdAt, + Instant startedAt, Instant updatedAt, int runtime, Map results) { @@ -45,7 +46,8 @@ public record Job( * @param state The next state of the job. * @param runtime The runtime of the job (in seconds). * @param results The results of the job. + * @param report The report containing warnings and errors. */ @Schema(name = "Runner.Job.Update") - public record Update(JobState state, int runtime, Map results) {} + public record Update(JobState state, int runtime, Map results, Report report) {} } diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Report.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Report.java new file mode 100644 index 00000000..8ade8def --- /dev/null +++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Report.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 AtLarge Research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package org.opendc.web.proto.runner; + +import java.util.List; +import org.eclipse.microprofile.openapi.annotations.media.Schema; + +/** + * A report containing metadata, logs, and summary information about a simulation job. + */ +@Schema(name = "Runner.Report") +public record Report(String createdAt, String startedAt, List logs, Summary summary, ErrorInfo error) { + + /** + * A single log entry captured during simulation execution. + */ + @Schema(name = "Runner.Report.LogEntry") + public record LogEntry(String timestamp, String level, String logger, String message) {} + + /** + * Aggregate summary of the simulation job. + */ + @Schema(name = "Runner.Report.Summary") + public record Summary(int totalWarnings, int totalErrors, Integer runtimeSeconds, Integer waitTimeSeconds) {} + + /** + * Error information when a simulation job fails. + */ + @Schema(name = "Runner.Report.ErrorInfo") + public record ErrorInfo(String message, String type, String stackTrace) {} +} -- cgit v1.2.3