nanoslurm
nanoslurm is a zero-dependency Python wrapper for SLURM job submission and monitoring.
It uses a tiny POSIX-compatible shell script to call sbatch and related commands, avoiding any heavy Python dependencies.
Features
- Submit jobs from Python without
pyslurmor other packages - Monitor status (
PENDING,RUNNING,COMPLETED, etc.) - Cancel jobs
- Tail job logs
- Get detailed info via
scontrol - Respects working directory at runtime (
sbatch -D)
Requirements
- SLURM cluster with
sbatch,squeue, and optionallysacct/scontrol - Python ≥ 3.11
- Linux operating system
Quickstart
import nanoslurm
job = nanoslurm.submit(
command=["python", "train.py", "--epochs", "10"],
name="my_job",
cluster="gpu22",
time="01:00:00",
cpus=4,
memory=16,
gpus=1,
stdout_file="./slurm_logs/%j.txt",
stderr_file="./slurm_logs/%j.err",
signal="SIGUSR1@90",
workdir="."
)
print(job) # Job(id=123456, name='my_job_2025-08-08_09-12-33.123', ...)
print(job.status) # "PENDING", "RUNNING", ...
print(job.is_running()) # True / False
print(job.is_finished()) # True / False
print(job.info()) # Detailed dict from scontrol
job.tail(10) # Last 10 lines of stdout
job.wait(poll_interval=5) # Wait until completion
job.cancel() # Cancel job
Command line interface
Install the CLI with uv:
uv tool install nanoslurm
Submit a job from the terminal:
nslurm run -c gpu22 -t 01:00:00 -p 4 -m 16 -g 1 -- python train.py --epochs 10
Launch an interactive prompt to build a command and adjust options:
nslurm run -i
Manage persistent defaults (stored as YAML via platformdirs):
nslurm defaults show # list current defaults
nslurm defaults set cluster gpu22
nslurm defaults reset
nslurm defaults edit # open the YAML config in $EDITOR
Most job parameters (such as cluster, time, or resource counts) have no built-in
defaults. Set them explicitly on the command line or persist them via
nslurm defaults set.
Launch the interactive job monitor:
nanoslurm monitor
Use the arrow keys or h, j, k, l to move around and q to quit.
Releasing
Bump the version in pyproject.toml and merge the change into main. A
workflow will tag the commit as vX.Y.Z and publish the package to PyPI.
Metadata
Release files for nanoslurm 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nanoslurm-0.1.12.tar.gz | 16.8 kB | Without provenance | Details for nanoslurm-0.1.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nanoslurm-0.1.12-py3-none-any.whl | Python 3 | none | any | Details for nanoslurm-0.1.12-py3-none-any.whl |
Total release size: 36.7 kB
Release files / nanoslurm-0.1.12.tar.gz
| Download URL | nanoslurm-0.1.12.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
865fb22b6626c01abd3d16ee35f8250149a431910c4ab98310667d606f11bba0
|
|
BLAKE2b-256 checksum How to use checksums |
6ec7105f3f63b8ff7078def44b1966787be9b17c46384a6cc1cb711307baba20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.17
|
Release files / nanoslurm-0.1.12-py3-none-any.whl
| Download URL | nanoslurm-0.1.12-py3-none-any.whl |
|---|---|
| Size | 19.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
30f6e66e53e2295851710bbcf797c274db65f13f6b235e4ae27315d8681b4682
|
|
BLAKE2b-256 checksum How to use checksums |
ffa093ed1743efca94cd4e946a06a6da6ce2978e71176aaf637325bf08034601
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.17
|
Security for nanoslurm 0.1.12
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.