Skip to content

fix(campaign): optional cache_root keeps job temp files and caches off $HOME - #1768

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/hpc-keep-off-home
Nov 12, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/hpc-keep-off-home

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Campaign job scripts can now keep temp files and tool caches off $HOME and the compute node's /tmp. On RAL, compute nodes don't mount the login node's /home, so ~ and /tmp there sit on a tiny local OS disk. pip, matplotlib, numba, CUDA/Triton, astropy, the PyAutoNerves JAX cache and Python's tempfile all default to those places and have been crashing nodes (RAL admin warnings 2026-09-25 and 2026-11-12).

A campaign.yaml can now name a cache_root:. The generated Slurm script then fills TMPDIR, XDG_CACHE_HOME and the per-tool cache variables under it, without overriding anything the job already has. Without cache_root: the script is exactly what it was before.

Closes part of #1767 (phase A, library leg; the workspace activate.sh PRs follow).

API Changes

  • New optional top-level campaign.yaml key cache_root: (absolute path; validated). Exposed as Campaign.cache_root.
  • SubmitRequest gains cache_root: Optional[str] = None, filled by requests_for.
  • sbatch_script emits fill-if-unset exports after set -euo pipefail and before the stage env (so a stage's own env still wins). The JAX_COMPILATION_CACHE_DIR export uses ${VAR-...}, so an explicitly empty value still disables the JAX cache.
  • No behaviour change for campaigns without cache_root:.
    See full details below.

Test Plan

  • pytest test_autofit/campaign: 158 pass, 4 new tests. They check: no cache_root → no cache variables; the exact export lines and their order; running the generated block under bash with a path containing a space and $ (directories created, job env wins, empty JAX value stays empty); cache_root must be absolute; a dry-run submit carries it.
  • Full pytest test_autofit/ (the ship gate).
Full API Changes (for automation & release notes)

Added

  • campaign.yaml cache_root: <absolute path>: where a job's temp files and caches go
  • autofit.campaign.spec.Campaign.cache_root
  • autofit.campaign.scheduler.base.SubmitRequest.cache_root
  • autofit.campaign.scheduler.slurm.CACHE_DIRS: (variable, path under cache_root) pairs: TMPDIR → tmp, XDG_CACHE_HOME → .cache, PIP_CACHE_DIR, MPLCONFIGDIR, NUMBA_CACHE_DIR, CUDA_CACHE_PATH, TRITON_CACHE_DIR, ASTROPY_CACHE_DIR, JAX_COMPILATION_CACHE_DIR → .cache/...

Migration

  • None required. To opt in, add cache_root: /mnt/ral/<user> to a campaign.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…f $HOME

A campaign.yaml can name `cache_root:`; the generated Slurm script then fills
unset TMPDIR, XDG_CACHE_HOME and the pip/matplotlib/numba/CUDA/Triton/astropy/
JAX cache variables under it (JAX with ${VAR-...} so an empty value still
disables the cache). Stage env still wins. On RAL, compute nodes keep $HOME
and /tmp on a tiny local disk that these tools filled (admin 2026-11-12).
No change for campaigns without cache_root.

Refs #1767

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant