Skip to main content

jobmanager

A command-line tool to manage SLURM jobs via sacct, squeue, sbatch, and scancel.

Requirements

  • Python 3.7+
  • SLURM (sacct, squeue, scontrol, scancel)
  • PyYAML (pip install pyyaml, included as a dependency)

Installation

pip install slurm-jobmanager

Or install directly from the repository:

git clone https://github.com/Dannyzimmer/SlurmJobManager
cd SlurmJobManager
pip install .

Intended workflow

[!Important] jobmanager is designed to run only one job at a time for a given directory. This encourages an organized workflow where each job has its own directory with associated metadata and logs. Running multiple jobs in the same directory is not supported and may lead to incorrect behavior.

Each job lives in its own directory containing a metadata.json file (auto generated via sacct -j <jobid> --json > metadata.json). The typical usage pattern is:

jobs/
├── run_001/
│   ├── metadata.json
│   └── job_logs
│       ├── LOG_run_001_6552064.log
│       └── LOG_run_001_6552081.log
├── run_002/
│   ├── metadata.json
│   └── job_logs
│       ├── LOG_run_001_6552092.log
│       └── LOG_run_001_6552101.log

Navigate to the job directory and run commands without extra flags — jobmanager picks up metadata.json automatically:

cd jobs/run_001
jobmanager status
jobmanager watch

Job identification

All job-specific commands resolve the target job in this order:

  1. --jobid ID — fetch metadata from SLURM on the fly
  2. --metadata FILE — use an explicit metadata file
  3. (default) — use metadata.json in the current directory

Commands

list

List your active jobs (wraps squeue).

jobmanager list
jobmanager list --user alice

status

Print the current state of a job (RUNNING, PENDING, COMPLETED, …).

jobmanager status

summary

Print a full summary: partition, CPUs, memory, elapsed time, state, working directory, etc.

jobmanager summary

elapsed

Print the elapsed wall-clock time of a job.

jobmanager elapsed

watch

Stream the job's stdout in real time until it reaches a terminal state.

jobmanager watch
jobmanager watch --interval 10   # poll every 10 s (default: 5)

stop

Cancel a job (scancel). Prompts for confirmation unless --yes is passed.

jobmanager stop
jobmanager stop --yes

print-request

Print a SLURM batch script header reproducing the resource requests of the job. Redirect to a file to reuse it.

jobmanager print-request > job.sh

resubmit

Resubmit a job using the original submission command recovered from sacct. If the current job is still active, prompts to cancel it first.

jobmanager resubmit

template

Create a run.sh SLURM batch script in the current directory. Job name is set automatically from the directory name.

jobmanager template            # blank placeholders (must be filled before submitting)
jobmanager template --test     # 1 node, 1 task, 1 CPU, 1 GB, 1 min
jobmanager template --quick    # 1 node, 1 task, 2 CPUs, 4 GB, 1 h
jobmanager template --medium   # 1 node, 4 tasks, 8 CPUs, 32 GB, 24 h

If a requirements.txt is present in the current directory, jobmanager template automatically appends a virtualenv setup block to the script:

# module load python/3.11   ← only if module_loads is set in config
python3 -m venv .venv         # or ${TMPDIR}/.venv_${SLURM_JOBID} if tmp_dir_var is set
source .venv/bin/activate
pip install -r requirements.txt

config

Manage the configuration file (~/.config/jobmanager/config.yaml).

jobmanager config init    # create the config file with documented defaults
jobmanager config edit    # open the config file in an interactive editor

Available settings:

Key Default Description
tmp_dir_var (unset) Environment variable holding the node's local temp dir (e.g. TMPDIR, LOCAL_SCRATCH). Used for venv placement.
module_loads [] List of environment modules to load before creating a virtualenv.
log_dir job_logs Directory for SLURM log files (relative to the working directory).
sacct_retries 6 Times to retry sacct when a job is not yet registered in the accounting DB.

submit

Validate and submit a batch script via sbatch. Checks for zero-value resource directives and warns if the current directory's job is still active.

jobmanager submit              # uses run.sh in the current directory
jobmanager submit path/to/script.sh

Metadata

Release files for slurm-jobmanager 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slurm-jobmanager 0.2.1
File Size Uploaded Provenance Actions
slurm_jobmanager-0.2.1.tar.gz 12.9 kB Without provenance Details for slurm_jobmanager-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for slurm-jobmanager 0.2.1
File Interpreter ABI Platform Actions
slurm_jobmanager-0.2.1-py3-none-any.whl Python 3 none any Details for slurm_jobmanager-0.2.1-py3-none-any.whl

Total release size: 25.1 kB

Release files / slurm_jobmanager-0.2.1.tar.gz

Download URL slurm_jobmanager-0.2.1.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
28fd3c55ba2155dea781e39bd2e386eb5bdad84ad6754feee75679a45ca962c0
BLAKE2b-256 checksum
How to use checksums
3e637f41baa98c5ebaa22e3fbec26e18ab6e92dca3af62719be794b8db58ba65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / slurm_jobmanager-0.2.1-py3-none-any.whl

Download URL slurm_jobmanager-0.2.1-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93888add1d486291e824ad9d5f2802e554b6e5aba6e4f2323d8ecef9c7ef6488
BLAKE2b-256 checksum
How to use checksums
bfe9bd979bb1b0e42a58dc017b5f6f418557c1898b624ecfea207f231d8170f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for slurm-jobmanager 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page