Skip to main content

Minimal Slurm experiment runner with persistent SSH, YAML configs, and log streaming

Project description

slurmster

A minimal Python tool to run parameter-grid experiments on a Slurm cluster with persistent SSH, log streaming, and simple YAML configs — inspired by a small Bash prototype.

Highlights

  • CLI with subcommands: submit, monitor, status, fetch, cancel
  • YAML config (explicitly provided via --config)
  • Persistent SSH connection for low latency
  • Per-run working directories on the remote side
  • Automatic log redirection to stdout.log inside each run directory
  • Live log streaming (and re-attach later)
  • Local workspace to track runs and “fetched” state
  • Cancel jobs from local machine

Install (editable)

cd slurmster
pip install -e .

Or use a virtual environment first.

Quick start

  1. Prepare a config (see example/config.yaml).
  2. Submit jobs — the tool automatically uploads and schedules env_setup.sh as a lightweight Slurm job (idempotent) so preparation runs on a compute node:
slurmster --config config.yaml --user <remote_user> --host <remote_host> --password-env SLURM_PASS submit  # optional; otherwise you'll be prompted
  1. Stream logs (auto-starts on submit unless --no-monitor is passed), or re-attach later:
slurmster --config config.yaml --user <remote_user> --host <remote_host> monitor --exp exp_lr_0.01_epochs_5  # or --job <jobid>
  1. Check status of non-fetched runs:
slurmster --config config.yaml --user <u> --host <h> status
  1. Fetch finished runs (downloads each run dir into your local workspace):
slurmster --config config.yaml --user <u> --host <h> fetch
  1. Cancel a job:
slurmster --config example/config.yaml --user <u> --host <h> cancel --exp exp_lr_0.01_epochs_5
# or: --job 1234567

YAML schema

YAML skeleton

remote:
  base_dir: ~/experiments            # remote working root

files:
  push:
    - example/train.py               # any code/data files you need on remote
  fetch:
    - "model.pth"                   # optional; if omitted we fetch the entire run dir
    - "log.txt"

slurm:
  directives: |                      # SBATCH lines; placeholders allowed
    #SBATCH --job-name={base_dir}
    #SBATCH --partition=gpu
    #SBATCH --time=00:10:00
    #SBATCH --cpus-per-gpu=40
    #SBATCH --nodes=1
    #SBATCH --gres=gpu:1
    #SBATCH --mem=32G

run:
  command: |                         # your run command; placeholders allowed
    source venv/bin/activate
    python example/train.py --lr {lr} --epochs {epochs}           --save_model "{run_dir}/model.pth" --log_file "{run_dir}/log.txt"

  # ONE of the following:
  grid:
    lr: [0.1, 0.01, 0.001]
    epochs: [1, 2, 5, 10]
  # experiments:
  #   - { lr: 0.1, epochs: 1 }
  #   - { lr: 0.001, epochs: 10 }

Placeholders

  • {base_dir}: resolved remote base directory (e.g. /home/you/experiments)
  • Any run parameter placeholder, e.g. {lr}, {epochs}
  • {remote_dir}: the configured remote.base_dir
  • {run_dir}: the per-run directory (under remote.base_dir/runs/{exp_name})

Local workspace

Under the .slurmster directory next to your config.yaml (<config-dir>/.slurmster/<user>@<host>/<sanitized-remote-base>), we store:

  • runs.json — run registry (job id, exp name, fetched flag, etc.)
  • results/<exp_name>_<job_id>/... — fetched run directories

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slurmster-0.2.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slurmster-0.2.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file slurmster-0.2.0.tar.gz.

File metadata

  • Download URL: slurmster-0.2.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for slurmster-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7d6a767bc4c917416ff28bf0c6c964bfa1ab14b3a4d23d6d3b6dc89e3fed9e45
MD5 f3b1c1b308ba8bf652e273a0b5c6c7f0
BLAKE2b-256 313a83f890d7e067a6c09d28428b752a8649d3f9d8fb3dbd07bc254ae915d0ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for slurmster-0.2.0.tar.gz:

Publisher: python-publish.yml on dyigitpolat/slurmster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slurmster-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: slurmster-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for slurmster-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7fc077969ed7d4869a5ada52e29c0aa2f436cb08a7d0d56228b9a5fc293776d
MD5 df8cca293051e328a83b09310a457ead
BLAKE2b-256 b375f304e2cca86841d570ccc9c6a34922680cf4c88a8af10ffdac5d769374a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for slurmster-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on dyigitpolat/slurmster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page