From 8d00c5176459589eed365f10717e61d9fbd63eb0 Mon Sep 17 00:00:00 2001 From: "pascal.tremblin" Date: Sun, 29 Nov 2026 17:42:02 +0100 Subject: [PATCH] studio: README and commit messages of campaign repositories in English The README.md of a new campaign repository, the messages of the commits the studio makes there (creation, physics, launch), the shell comments of the physics directory in the launch settings and the header of the ini of the initial condition alone are written in English, whatever the language of the studio. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 + tools/trame/canop_campaign.py | 85 ++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba56f19..3d6a77a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The user-visible changes of canoP, by version (see `CONTRIBUTING.md` for the ver English, whatever the language of the studio. - canoP studio: the example of the parameters to vary in New campaign uses the current keys (`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. ## 0.1.0 - 2026-11-27 diff --git a/tools/trame/canop_campaign.py b/tools/trame/canop_campaign.py index 10f6ff9..4b0b515 100644 --- a/tools/trame/canop_campaign.py +++ b/tools/trame/canop_campaign.py @@ -835,7 +835,7 @@ def submit_campaign(name, only=None): last = [line for line in out.strip().splitlines() if line.strip()][-3:] return False, tr("signac-flow submit : %s") % (" | ".join(last) or tr("rien soumis (code %d)") % code), 0 try: - launch_commit(proj.path, "lancement : %d run(s) de %s\n\ncanoP %s, physique %s\nruns : %s" % ( + launch_commit(proj.path, "launch: %d run(s) of %s\n\ncanoP %s, physics %s\nruns: %s" % ( submitted, name, version.get("commit", "?"), physics, ", ".join(j[:8] for j in todo))) except (OSError, RuntimeError, subprocess.TimeoutExpired) as err: app.notify(tr("Runs soumis, mais le commit du lancement a échoué : %s") % err, "warning") @@ -1069,53 +1069,54 @@ def _version_text(v): """ REPO_README = """\ -# Campagne {name} (canoP studio) +# Campaign {name} (canoP studio) -Dépôt git de la campagne, tenu par canoP studio : chaque lancement d'un run y fait un commit. +Git repository of the campaign, kept by canoP studio: each launch of a run makes a commit in it. -Versionné : +Versioned: -- `physics/` : la physique de la campagne, tous les fichiers Python compilés par pykokkos au - lancement des runs. Copiée des sources de canoP à la création de la campagne : la physique de la - campagne se modifie ici, pas dans les sources de canoP. -- `workspace//` : l'ini de chaque run, sa vue (`canoP_view.py`, `canoP_fields.py`), son point - d'état et son document signac (`signac_statepoint.json`, `signac_job_document.json`). -- `analysis.py` (onglet Analyse), le projet signac-flow (`project.py`, `templates/`), - `.signac/config` et `signac_project_document.json` (ini de base, balayage, réglages de la - dernière soumission). +- `physics/`: the physics of the campaign, all the Python files compiled by pykokkos when the runs + are launched. Copied from the canoP sources when the campaign was made: the physics of the + campaign is changed here, not in the canoP sources. +- `workspace//`: the ini of each run, its view (`canoP_view.py`, `canoP_fields.py`), its signac + state point and job document (`signac_statepoint.json`, `signac_job_document.json`). +- `analysis.py` (Analysis tab), the signac-flow project (`project.py`, `templates/`), + `.signac/config` and `signac_project_document.json` (base ini, sweep, settings of the last + submission). -Non versionné : les sorties et les journaux des runs, `workspace//canoP_physics/`. +Not versioned: the outputs and logs of the runs, `workspace//canoP_physics/`. -## Un lancement +## A launch -1. Si `physics/` a changé depuis le lancement précédent, commit « physique : ... ». -2. En tête de l'ini du run, des lignes `# [canoP studio]` : le commit de canoP (celui de la - compilation de l'exécutable) et le commit de la physique (dans ce dépôt). -3. La physique de ce commit est copiée dans `workspace//canoP_physics/` ; le job la lit par la - variable `CANOP_PHYSICS_DIR`. Modifier `physics/` ensuite ne change pas un run déjà lancé. -4. Commit « lancement : ... » : les ini, vues et documents. +1. If `physics/` changed since the previous launch, a commit "physics: ...". +2. At the top of the ini of the run, `# [canoP studio]` lines: the commit of canoP (that of the + build of the executable) and the commit of the physics (in this repository). +3. The physics of that commit is copied into `workspace//canoP_physics/`; the job reads it + through the variable `CANOP_PHYSICS_DIR`. Changing `physics/` afterwards does not change a run + already launched. +4. A commit "launch: ...": the inis, views and documents. -Le document signac de chaque run (`signac_job_document.json`) garde aussi les deux commits -(`canop`, `physics`). +The signac document of each run (`signac_job_document.json`) also keeps both commits (`canop`, +`physics`). -## Reproduire +## Reproduce -1. canoP au commit noté dans l'ini du run, compilé par le studio : +1. canoP at the commit written in the ini of the run, built by the studio: - git clone canoP - git -C canoP checkout + git clone canoP + git -C canoP checkout git -C canoP submodule update --init --recursive -2. Ce dépôt dans les campagnes de ce canoP (le dossier `_campaigns` à côté du dossier de - compilation, `_build` par défaut) : +2. This repository in the campaigns of that canoP (the directory `_campaigns` next to the build + directory, `_build` by default): - git clone canoP/_campaigns/{name} + git clone canoP/_campaigns/{name} - Pour la physique d'un lancement plus ancien : `git checkout ` puis une branche - (`git switch -c reproduction`). Le studio ne lance pas depuis un commit détaché. -3. Dans le studio, campagne {name} : « Préparer à nouveau » remet les runs soumis sans aucun - fichier (ceux du clone) à l'état préparé, puis « Lancer les runs préparés ». Un run seul : - onglet Run, « Lancer ». + For the physics of an older launch: `git checkout `, then a branch + (`git switch -c reproduction`). The studio does not launch from a detached commit. +3. In the studio, campaign {name}: "Prepare again" sets the submitted runs that have no files + (those of the clone) back to prepared, then "Launch the prepared runs". A single run: Run tab, + "Run". """ _repo_cache = {} # campaign path: (time, summary of its repository) @@ -1182,9 +1183,9 @@ def ensure_repo(path): _git(path, "add", "-A") v = git_state(source) changed = [f for f in v.get("modified", []) if f.startswith(PHYSICS + "/")] - _commit(path, "campagne %s : création du dépôt\n\nphysique copiée des sources de canoP %s (%s)%s" % ( + _commit(path, "campaign %s: repository created\n\nphysics copied from the canoP sources %s (%s)%s" % ( name, v.get("commit", "?"), v.get("branch", "?"), - "\nfichiers de la physique modifiés dans ces sources : " + ", ".join(changed) if changed else "")) + "\nfiles of the physics modified in these sources: " + ", ".join(changed) if changed else "")) except (OSError, RuntimeError, subprocess.TimeoutExpired) as err: return tr("dépôt git de la campagne %s : %s") % (name, err) _repo_cache.pop(path, None) @@ -1199,7 +1200,7 @@ def physics_commit(path): _git(path, "add", "-A", "--", PHYSICS) if _staged(path, PHYSICS): files = _git(path, "diff", "--cached", "--name-only", "--", PHYSICS).splitlines() - _commit(path, "physique : %s" % _files_text(files, PHYSICS + "/"), PHYSICS) + _commit(path, "physics: %s" % _files_text(files, PHYSICS + "/"), PHYSICS) commit = _git(path, "log", "-1", "--format=%H", "--", PHYSICS) if not commit: raise RuntimeError(tr("pas de physique (%s/) dans le dépôt %s") % (PHYSICS, path)) @@ -1250,7 +1251,7 @@ def physics_env(run_dir=None): The path is relative to the directory where canoP starts when run_dir is None. """ - return ("# la physique de ce lancement, copiée du dépôt git de la campagne (canoP studio)\n" + return ("# the physics of this launch, copied from the git repository of the campaign (canoP studio)\n" "export CANOP_PHYSICS_DIR=%s" % shlex.quote(os.path.join(run_dir, RUN_PHYSICS) if run_dir else RUN_PHYSICS)) @@ -1727,7 +1728,7 @@ def launch_editor_run(): job.doc["canop"] = version job.doc["physics"] = physics_doc(campaign, physics) try: - launch_commit(proj.path, "lancement : %s (run %s)\n\ncanoP %s, physique %s" % ( + launch_commit(proj.path, "launch: %s (run %s)\n\ncanoP %s, physics %s" % ( job_name(campaign, job), job.id[:8], version.get("commit", "?"), physics)) except (OSError, RuntimeError, subprocess.TimeoutExpired) as err: app.notify(tr("Run lancé, mais le commit du lancement a échoué : %s") % err, "warning") @@ -1832,8 +1833,8 @@ def ic_text(text): canoP then writes one output at the end: the initial condition refined level by level up to amr.max_refine, in the directory of the run. """ - text = with_versions(text, ["# condition initiale seule (canoP studio) : simulation.nstepmax = 0, physique " - "actuelle de la campagne, non versionnée"]) + text = with_versions(text, ["# initial condition only (canoP studio): simulation.nstepmax = 0, current physics of " + "the campaign, not versioned"]) text = core.ini_set(text, "simulation", "nstepmax", "0") if core.ini_get(text, "run", "nstepmax") is not None: # read instead of simulation.nstepmax text = core.ini_set(text, "run", "nstepmax", "0") @@ -1923,7 +1924,7 @@ def generate_initial_condition(): return env = settings.env_setup.rstrip("\n") if physics: - env += ("\n# condition initiale seule : la physique actuelle de la campagne %s (non versionnée)\n" + env += ("\n# initial condition only: the current physics of the campaign %s (not versioned)\n" "export CANOP_PHYSICS_DIR=%s" % (campaign, shlex.quote(physics))) settings = dataclasses.replace(settings, run_dir=ic_dir, env_setup=env) base = job_name(campaign, job) if job is not None else app.run_name()