Skip to content

fix: keep HPC temp and cache writes off $HOME and worker /tmp #1767

Closed

Description

@Jammy2211

Overview

The RAL admin reported (2026-11-12) worker nodes crashing from full OS disks: tools write caches and temp files to ~ and /tmp, which on compute nodes sit on a tiny local disk (workers don't mount the login node's /home; Slurm TmpFS=/tmp). The RAL login shell now redirects these (~/.bashrc.d/keep_off_home.sh), but jobs submitted with a restricted --export=VAR=... don't inherit it, so the repos must cover it themselves. Eight activate.sh files already move caches (after the 2026-09-25 warning) but none set TMPDIR; autocti_assistant moves nothing; PyAutoFit's generated campaign job scripts set nothing.

Plan

Phase A (now)

  • PyAutoFit: an optional top-level cache_root: in campaign.yaml; when set, the generated Slurm script fills unset TMPDIR and cache variables under it. Absent → script unchanged.
  • activate.sh in autofit_assistant, autofit_inference, autogalaxy_assistant, autolens_inference: add a fill-if-unset TMPDIR beside the existing PYAUTO_HPC_CACHE block.
  • autocti_assistant/activate.sh: add the full cache block + TMPDIR to its HPC branch.
  • Library PR first, then the workspace PRs.

Phase B (blocked: repos claimed by other tasks)

  • Same TMPDIR line in autofit_profiling, autolens_assistant, autolens_profiling, euclid_strong_lens_modeling_pipeline.

Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary

Detailed implementation plan

Affected Repositories

  • PyAutoFit (primary)
  • autofit_assistant, autofit_inference, autogalaxy_assistant, autolens_inference, autocti_assistant (phase A)
  • autofit_profiling, autolens_assistant, autolens_profiling, euclid_strong_lens_modeling_pipeline (phase B)

Branch Survey

Repository Current Branch Dirty?
PyAutoFit main clean
autofit_assistant main clean
autofit_inference main clean
autogalaxy_assistant main clean
autolens_inference main 11 files (other work; worktree unaffected)
autocti_assistant main clean
autofit_profiling claimed: nautilus-spawn-training-pool —
autolens_assistant claimed: results-library-p5a-assistant —
autolens_profiling claimed: gradient-correctness-sweep —
euclid_strong_lens_modeling_pipeline claimed: sky-orientation-p2 —

Suggested branch: feature/hpc-keep-off-home

Implementation Steps

  1. autofit/campaign/spec.py: parse optional top-level cache_root on Campaign; document it in the module docstring YAML example.
  2. autofit/campaign/scheduler/base.py: SubmitRequest.cache_root: Optional[str] = None; set where requests are built from the campaign (autofit/campaign/submit.py).
  3. autofit/campaign/scheduler/slurm.py sbatch_script: when cache_root is set, after set -euo pipefail emit fill-if-unset exports — TMPDIR=<root>/tmp, XDG_CACHE_HOME=<root>/.cache, PIP_CACHE_DIR, MPLCONFIGDIR, NUMBA_CACHE_DIR, CUDA_CACHE_PATH, TRITON_CACHE_DIR, ASTROPY_CACHE_DIR under it, JAX_COMPILATION_CACHE_DIR with ${VAR-...} (an empty value still disables) — plus mkdir -p ... || true. Stage env: still overrides.
  4. Tests in test_autofit/campaign/test_slurm.py: no cache_root → script byte-identical to today; with it → exports present, fill-if-unset form, bash -n clean; stage env wins.
  5. Workspace activate.sh (5 repos): next to the PYAUTO_HPC_CACHE block, export TMPDIR="${TMPDIR:-$(dirname "$PYAUTO_HPC_CACHE")/tmp}" + mkdir -p ... || true; autocti_assistant gets the whole block copied from autofit_assistant. Keep the text identical across repos.
  6. Phase B: the same edit in the four claimed repos once their claims free.

Key Files

  • autofit/campaign/scheduler/slurm.py — job-script generator
  • autofit/campaign/spec.py, autofit/campaign/scheduler/base.py, autofit/campaign/submit.py
  • test_autofit/campaign/test_slurm.py
  • <repo>/activate.sh in each workspace repo

Out of scope

  • collaborator/development/autolens_profiling submits that hard-code worker /tmp (local repo, no remote).
  • Science euclid_dr1 submit_docs_tar (completed one-off run).

Original Prompt

Click to expand starting prompt

Keep HPC temp files and caches off $HOME and the worker's /tmp

Type: maintenance
Target: PyAutoFit
Repos:

  • PyAutoFit
  • autofit_assistant
  • autofit_inference
  • autofit_profiling
  • autogalaxy_assistant
  • autolens_assistant
  • autolens_inference
  • autolens_profiling
  • euclid_strong_lens_modeling_pipeline
  • autocti_assistant
    Difficulty: small
    Autonomy: supervised
    Priority: high
    Status: formalised
    Consequence: glance
    Witness: every RAL-capable activate.sh fills an unset TMPDIR (and autocti_assistant's HPC branch the full cache block) with a directory beside PYAUTO_HPC_CACHE on the shared disk; a job script from PyAutoFit's Slurm scheduler exports fill-if-unset TMPDIR/XDG_CACHE_HOME when a cache root is configured, with tests; nothing writes to ~ or /tmp on a worker by default.
    Review-minutes: 5
    Filed: 2026-11-12

Request (verbatim, RAL admin 2026-11-12)

I'd like to remind all users that if they use VSCode, Claude, and various Python local
tools that they need do define their ENV vars to preclude use of /home/USERNAME when
running these through Slurm. Point all temp/cache env vars to the shared disk instead.
The worker nodes have tiny OS disks, and I'm finding multiple nodes crashing due to
"out of space" errors caused by the aforementioned utilities dumping data into
~/.cache, ~/.vscode, ~/copilot, ~/.claude, etc.

Human: "make sure true for all places we interact with RAL".

What is already done

  • RAL login node: ~/.bashrc.d/keep_off_home.sh (installed 2026-11-12) fills unset
    TMPDIR, XDG_*, pip/matplotlib/numba/CUDA/Triton/astropy/HF/JAX caches,
    CLAUDE_CONFIG_DIR, VSCODE_AGENT_FOLDER and COPILOT_HOME under /mnt/ral/jnightin. Jobs
    inherit it through sbatch's default --export=ALL. Jobs submitted with a restricted
    --export=VAR=... do NOT, so the repos must still cover it themselves.
  • Facts: compute nodes do not mount the login node's /home; Slurm TmpFS=/tmp is on the
    tiny OS disk.
  • 8 activate.sh files already redirect caches to $PYAUTO_HPC_CACHE (added after the
    2026-09-25 warning) but none set TMPDIR.

Scope

  1. In the HPC branch of each RAL-capable activate.sh (autofit_assistant, autofit_inference,
    autofit_profiling, autogalaxy_assistant, autolens_assistant, autolens_inference,
    autolens_profiling, euclid_strong_lens_modeling_pipeline), add a fill-if-unset
    TMPDIR next to the PYAUTO_HPC_CACHE block (a tmp/ beside .cache/, mkdir -p || true). Keep the blocks identical across repos.
  2. cti/autocti_assistant/activate.sh: its PYAUTO_HPC_BASE branch has no redirection;
    add the same full cache + TMPDIR block.
  3. PyAutoFit autofit/campaign/scheduler/slurm.py: generated job scripts source no
    activate.sh and set no cache env. Emit fill-if-unset exports (TMPDIR, XDG_CACHE_HOME,
    and the cache vars) when the site/request names a cache root, and cover it in
    test_autofit/campaign/test_slurm.py.

Out of scope (not PR-able)

  • collaborator/development/autolens_profiling (local git repo, no remote): ~10 submits in
    hpc/batch_{cpu,gpu}/ hard-code worker /tmp. Fix by local edit if they are ever re-run.
  • Science euclid_dr1 hpc/run_manifests/eclipse_r2_add_unmodelled_20261030/submit_docs_tar
    writes a tar to worker /tmp; a completed one-off run.

Activity

  1. Jammy2211 commented on Nov 12, 2026

    @Jammy2211
    CollaboratorAuthor

    Library PR created: #1768 (PyAutoFit, optional cache_root in campaign job scripts). Full test suite passed: 4288 passed, 2 skipped, 1 xfailed. Heart YELLOW (unrelated: PyAutoArray open PR 8d old), acknowledged by the human. Next: workspace activate.sh PRs (autofit_assistant, autofit_inference, autogalaxy_assistant, autolens_inference, autocti_assistant).

  2. Jammy2211 commented on Nov 12, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped (phase A), merged 2026-11-12 under the approved glance tier:

    Witness: nothing writes to ~ or a worker's /tmp by default. Checked by the new PyAutoFit tests (cache block run under bash, job env wins, empty JAX value kept) and a clean-env source of each activate.sh. CI green on every run and leg.

    Phase B (the same TMPDIR line in autofit_profiling, autolens_assistant, autolens_profiling, euclid_strong_lens_modeling_pipeline) is blocked on other tasks' repo claims. It is re-filed as a Mind draft and will get its own issue when unblocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions