Skip to content
Projects

slurm-remote

slurm-remote is for testing local code on a cluster: it syncs the project with rsync, submits a batch script with sbatch, follows the job and fetches results back. Everything runs through SLURM, never on the login node.

slurm-remote --host mycluster run job.sh --fetch out
slurm-remote --host mycluster run job.sh -- pytest -x tests/

The host and remote directory come from, in order of precedence, the flags --host and --remote-dir, the environment variables SLURM_REMOTE_HOST and SLURM_REMOTE_DIR, and a slurm-remote.json in the project directory:

{
"host": "mycluster",
"remote_dir": "~/scratch",
"excludes": [".git", ".venv", "__pycache__"],
"setup": ["module load python-waterboa", "source ~/venvs/dev/bin/activate"],
"poll_interval": 30
}

The project lands in <remote_dir>/<local directory name>, so separate worktrees do not overwrite each other. setup lines are put before a command given to run.


CommandWhat it does
sync [--delete]Rsync the project to the cluster (.git, .venv, caches and build output are excluded by default).
submit SCRIPTSync, sbatch the script and print the job id.
status JOB_IDPrint the job state, from squeue or else sacct.
logs JOB_ID [-f] [-n N]Show, or follow, the job’s stdout file.
fetch PATH...Copy files from the remote project directory back, keeping their layout.
run SCRIPT [--fetch PATH...] [-- COMMAND]Sync, submit, wait, show the log tail and fetch. Exits non-zero unless the job completed.

With -- COMMAND, run keeps the #SBATCH pragmas of the script but runs your command (after the setup lines) instead of the script body.


  • SSH connections are multiplexed (ControlMaster, 4 h), so you authenticate once, also with 2FA. Turn it off with --no-multiplex if your site forbids it.
  • Status polling is limited to at most one check per 15 s, whatever poll_interval says.
  • Compute only happens in submitted jobs. Do not use sync to push large environments; build them on the cluster.