From b00a6e682d9bbca3b4be5ed7c5d457a2aa3a3ab9 Mon Sep 17 00:00:00 2001 From: "pascal.tremblin" Date: Sun, 29 Nov 2026 18:40:35 +0100 Subject: [PATCH] studio: forget the metrics of a previous launch when a run is launched again "Prepare again" moved the record of the previous launch of a run to its history but left its metrics, and a relaunch from the Run tab removed the outputs but not the metrics. project.py computes the metrics of a finished run only when it has none, so the new launch kept the old numbers: in a campaign cloned from its git repository, those measured on the machine of whoever ran it first. The metrics now go to the history with the rest of the record on "Prepare again", and are removed with the outputs on a relaunch from the Run tab. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 +++ tools/trame/canop_campaign.py | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d6a77a..d0e8a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ The user-visible changes of canoP, by version (see `CONTRIBUTING.md` for the ver (`simulation.cfl`, `amr.max_refine`). - canoP studio: the git repository of a new campaign has its `README.md` in English, and the commits the studio makes there (creation, physics, launch) have English messages. +- canoP studio: a run prepared again (e.g. in a campaign cloned from its git repository) or + relaunched from the Run tab no longer keeps the metrics of its previous launch; those of the new + launch are computed when it finishes. ## 0.1.0 - 2026-11-27 diff --git a/tools/trame/canop_campaign.py b/tools/trame/canop_campaign.py index 4b0b515..74c7125 100644 --- a/tools/trame/canop_campaign.py +++ b/tools/trame/canop_campaign.py @@ -1385,7 +1385,8 @@ def reset_names(rows): def reset_runs(name): """Prepare again the runs submitted without any file; return (ok, message, number). - The record of their launch moves to doc["history"]. + The record of their launch (dates, versions, metrics) moves to doc["history"]: metrics left there + (those of a clone, made elsewhere) would stop project.py from computing those of the new run. """ proj = project(name) _, rows = jobs_table(name) @@ -1393,7 +1394,7 @@ def reset_runs(name): for job_id in ids: job = proj.open_job(id=job_id) doc = _plain(job.doc()) - past = {k: doc[k] for k in ("submitted", "launched", "canop", "physics") if k in doc} + past = {k: doc[k] for k in ("submitted", "launched", "canop", "physics", "metrics") if k in doc} if past: job.doc["history"] = list(_plain(doc.get("history")) or []) + [past] for k in past: @@ -1588,7 +1589,12 @@ def _on_editor_text(ini_text=None, **_): def _clear_outputs(campaign, job, texts): - """Remove the outputs of a previous launch of the run (before relaunching it).""" + """Remove the outputs and the metrics of a previous launch of the run (before relaunching it). + + The metrics of the new launch are computed when it finishes, only if the run has none. + """ + if "metrics" in job.doc: + del job.doc["metrics"] for text in texts: out_dir = os.path.normpath(os.path.join(job.path, core.ini_get(text, "output", "outputDir", "./") or "./")) prefix = core.output_prefix(text, out_dir)