From b00d33ecc4d2a8e654b669002fbe1b322f64c5a4 Mon Sep 17 00:00:00 2001 From: sotashimozono Date: Tue, 8 Sep 2026 10:15:51 +0000 Subject: [PATCH] fix: the config decides where its results go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every driver computed `OUTDIR` from the environment and handed it to `DataVault.Vault` as a keyword. `Vault` already resolves that itself — keyword, then `DATAVAULT_OUTDIR`, then the config's `[study] outdir` — and a keyword wins, so passing one made the config's own setting permanently unreachable. The comment above the line said "outdir precedence (DataVault resolves it)" while the next line took the decision away from it. The drivers now pass `run=` only. Measured both directions, which is the point of the change: DATAVAULT_OUTDIR unset -> out/data/example/phase1/ (the config's [study] outdir) DATAVAULT_OUTDIR=/tmp/x -> /tmp/x/data/example/phase1/ (the environment overriding it) Before, the second worked and the first could not: the documented order was "environment beats config", the real order was "the script beats everything". --- projects/ExampleMonteCarlo/report/report.jl | 3 +-- projects/ExampleMonteCarlo/scripts/collect.jl | 3 +-- projects/ExampleMonteCarlo/scripts/compute.jl | 7 +++++-- projects/ExampleSweep/report/report.jl | 3 +-- projects/ExampleSweep/scripts/collect.jl | 3 +-- projects/ExampleSweep/scripts/compute.jl | 8 +++++--- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/projects/ExampleMonteCarlo/report/report.jl b/projects/ExampleMonteCarlo/report/report.jl index 6288305..9308794 100644 --- a/projects/ExampleMonteCarlo/report/report.jl +++ b/projects/ExampleMonteCarlo/report/report.jl @@ -7,9 +7,8 @@ using ExampleMonteCarlo: ExampleMonteCarlo using ParamIO: ParamIO const CONFIG = get(ARGS, 1, joinpath(@__DIR__, "..", "configs", "smoke.toml")) -const OUTDIR = get(ENV, "DATAVAULT_OUTDIR", joinpath(@__DIR__, "..", "out")) -vault = DataVault.Vault(CONFIG; run="phase1", outdir=OUTDIR) +vault = DataVault.Vault(CONFIG; run="phase1") rows = ExampleMonteCarlo.summarise(vault) # the same reduction scripts/collect.jl uses @info "reporting over" n = length(rows) diff --git a/projects/ExampleMonteCarlo/scripts/collect.jl b/projects/ExampleMonteCarlo/scripts/collect.jl index 328dc59..c7b7ed7 100644 --- a/projects/ExampleMonteCarlo/scripts/collect.jl +++ b/projects/ExampleMonteCarlo/scripts/collect.jl @@ -8,9 +8,8 @@ using ParamIO: ParamIO using Printf const CONFIG = get(ARGS, 1, joinpath(@__DIR__, "..", "configs", "smoke.toml")) -const OUTDIR = get(ENV, "DATAVAULT_OUTDIR", joinpath(@__DIR__, "..", "out")) -vault = DataVault.Vault(CONFIG; run="phase1", outdir=OUTDIR) +vault = DataVault.Vault(CONFIG; run="phase1") rows = ExampleMonteCarlo.summarise(vault) @printf("\n %-5s %-7s %-11s %-11s %s\n", "L", "kbT", "E/N", "|M|", "Binder") diff --git a/projects/ExampleMonteCarlo/scripts/compute.jl b/projects/ExampleMonteCarlo/scripts/compute.jl index 9a9bce1..5f8e314 100644 --- a/projects/ExampleMonteCarlo/scripts/compute.jl +++ b/projects/ExampleMonteCarlo/scripts/compute.jl @@ -18,11 +18,14 @@ using ParamIO: ParamIO using SweepRunner: SweepRunner const CONFIG = get(ARGS, 1, joinpath(@__DIR__, "..", "configs", "smoke.toml")) -const OUTDIR = get(ENV, "DATAVAULT_OUTDIR", joinpath(@__DIR__, "..", "out")) spec = ParamIO.load(CONFIG) keys = ParamIO.expand(spec) -vault = DataVault.Vault(CONFIG; run="phase1", outdir=OUTDIR) +# `outdir` is NOT passed. DataVault resolves it itself — kwarg, then DATAVAULT_OUTDIR, then the +# config's [study] outdir — and a kwarg wins, so reading the environment here and handing the result +# over would silently make the config's own setting unreachable. The config decides where its +# results go; the driver only says which run. +vault = DataVault.Vault(CONFIG; run="phase1") SweepRunner.init_workers!(; mode=:auto) opts = SweepRunner.RunOpts(; stop_flag=get(ENV, "PM_STOP_FLAG", nothing)) diff --git a/projects/ExampleSweep/report/report.jl b/projects/ExampleSweep/report/report.jl index 839178a..c10da56 100644 --- a/projects/ExampleSweep/report/report.jl +++ b/projects/ExampleSweep/report/report.jl @@ -8,9 +8,8 @@ using ExampleSweep: ExampleSweep using ParamIO: ParamIO const CONFIG = get(ARGS, 1, joinpath(@__DIR__, "..", "configs", "smoke.toml")) -const OUTDIR = get(ENV, "DATAVAULT_OUTDIR", joinpath(@__DIR__, "..", "out")) -vault = DataVault.Vault(CONFIG; run="phase1", outdir=OUTDIR) +vault = DataVault.Vault(CONFIG; run="phase1") rows = ExampleSweep.summarise(vault) # the same reduction scripts/collect.jl uses @info "reporting over" n = length(rows) diff --git a/projects/ExampleSweep/scripts/collect.jl b/projects/ExampleSweep/scripts/collect.jl index 34dbdc7..4298124 100644 --- a/projects/ExampleSweep/scripts/collect.jl +++ b/projects/ExampleSweep/scripts/collect.jl @@ -9,9 +9,8 @@ using ParamIO: ParamIO using Printf const CONFIG = get(ARGS, 1, joinpath(@__DIR__, "..", "configs", "smoke.toml")) -const OUTDIR = get(ENV, "DATAVAULT_OUTDIR", joinpath(@__DIR__, "..", "out")) -vault = DataVault.Vault(CONFIG; run="phase1", outdir=OUTDIR) +vault = DataVault.Vault(CONFIG; run="phase1") rows = ExampleSweep.summarise(vault) # the same reduction report/ uses @printf("\n %-8s %-10s %s\n", "a", "dt", "rel_error") diff --git a/projects/ExampleSweep/scripts/compute.jl b/projects/ExampleSweep/scripts/compute.jl index 2e94778..e8dca05 100644 --- a/projects/ExampleSweep/scripts/compute.jl +++ b/projects/ExampleSweep/scripts/compute.jl @@ -25,12 +25,14 @@ using ParamIO: ParamIO using SweepRunner: SweepRunner const CONFIG = get(ARGS, 1, joinpath(@__DIR__, "..", "configs", "smoke.toml")) -# outdir precedence, resolved by DataVault: kwarg > ENV > the config's [study]. -const OUTDIR = get(ENV, "DATAVAULT_OUTDIR", joinpath(@__DIR__, "..", "out")) spec = ParamIO.load(CONFIG) keys = ParamIO.expand(spec) -vault = DataVault.Vault(CONFIG; run="phase1", outdir=OUTDIR) +# `outdir` is NOT passed. DataVault resolves it itself — kwarg, then DATAVAULT_OUTDIR, then the +# config's [study] outdir — and a kwarg wins, so reading the environment here and handing the result +# over would silently make the config's own setting unreachable. The config decides where its +# results go; the driver only says which run. +vault = DataVault.Vault(CONFIG; run="phase1") SweepRunner.init_workers!(; mode=:auto)