From 82c00373509405c5744ac29ae70d2d2bac944231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Petrovick=C3=BD?= Date: Tue, 1 Oct 2024 08:17:07 +0200 Subject: [PATCH] Respect run ID --- .../solver/benchmarks/micro/common/AbstractMain.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/ai/timefold/solver/benchmarks/micro/common/AbstractMain.java b/src/main/java/ai/timefold/solver/benchmarks/micro/common/AbstractMain.java index 0887c253..9a7ebe4d 100644 --- a/src/main/java/ai/timefold/solver/benchmarks/micro/common/AbstractMain.java +++ b/src/main/java/ai/timefold/solver/benchmarks/micro/common/AbstractMain.java @@ -38,6 +38,7 @@ import java.time.Instant; import java.time.ZoneId; import java.util.Arrays; +import java.util.Objects; import java.util.Optional; import java.util.Properties; @@ -54,14 +55,13 @@ public abstract class AbstractMain { protected final Logger LOGGER = LoggerFactory.getLogger(getClass()); private final String subpackage; - private final String runId; private final Path resultsDirectory; protected AbstractMain(String subpackage) { this.subpackage = subpackage; - var runId = System.getenv("RUN_ID"); - this.runId = runId == null || runId.isBlank() ? getTimestamp() : runId.strip(); - this.resultsDirectory = Path.of("results", subpackage, getTimestamp()); + var runId = Objects.requireNonNullElse(System.getenv("RUN_ID"), getTimestamp()) + .strip(); + this.resultsDirectory = Path.of("results", subpackage, runId); resultsDirectory.toFile().mkdirs(); }