Skip to content

feat: symlink the shared MESH instead of copying it (save disk space) #14

Description

@florian-simvia

Problem

csauto prepare copies the shared MESH/ (and POST/) once into RUNS/MESH via
_copy_shared_dir (csauto/doe.py:282). For large meshes (.med files can be GBs) this
physical copy wastes disk space — the mesh already exists at the study level. Cases
reference it relatively (../MESH), so a symlink would work in principle.

Note: the copy is already shared (one RUNS/MESH, not one per case), and
_copy_shared_dir already partially tolerates symlinks (doe.py:103-114).

⚠️ The container trap (must be handled)

Docker/Singularity mount only the RUNS directory:

docker run -v <RUNS>:/home/code_saturne ...          # docker.py:27
apptainer ... --bind <RUNS>:/home/code_saturne ...    # execution.py:227

If RUNS/MESH becomes a symlink pointing to a source outside RUNS (e.g.
/study/MESH), then inside the container the target is not mounted → mesh not found,
run fails
. A naive symlink works natively but breaks Docker/Singularity runs.

Candidate approaches (developer picks)

  1. Symlink + auto bind-mountRUNS/MESH becomes a symlink, and csauto also adds a
    read-only bind of the mesh source into the container at /home/code_saturne/MESH.
    Works native + docker + singularity; touches docker.py + execution.py.
  2. Config mesh_mode = copy|symlink — opt-in symlink (default stays copy,
    backward-compatible); document the container caveat. Minimal, no mount changes.
  3. Symlink only — simplest, native-only; explicitly breaks containers. Only if
    container runtimes are out of scope.

The maintainer should choose based on how important container runtimes are (they are
commonly used here) vs. implementation cost.

Acceptance criteria

  • Large shared MESH no longer physically duplicated when the chosen mode is active.
  • Native runs resolve the mesh correctly.
  • Docker and Singularity runs resolve the mesh correctly (or the limitation is
    explicitly documented and guarded with a clear warning if the naive path is taken).
  • Docs (docs/concepts.md or run-lifecycle.md) note the mesh handling + any caveat.
  • Tests cover the chosen mode (symlink created / mount added, per runtime).

Notes

  • Same reasoning applies to POST/ (also shared-copied at doe.py:283).
  • Windows: symlinks need privileges/dev-mode; keep copy as a safe fallback there.

Metadata

Metadata

Labels

enhancementNew feature or request

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions