slurmly
SSH-only Slurm client library for Python.
slurmly controls Slurm clusters by running the standard CLI (sbatch, squeue, sacct,
scancel) over SSH against a login node. No REST API, no PySlurm, no C bindings —
if you can ssh to the login node, you can drive jobs from Python.
- Fully typed (Pydantic v2),
async-first, framework-agnostic. - First-class support for job arrays, dependencies, batched status, artifacts, cleanup, and capability detection.
- Observable via typed hooks; testable with an in-memory
FakeTransport(no SSH or cluster required).
Installation
pip install slurmly
Requires Python 3.11+. Runtime dependencies: asyncssh>=2.14, pydantic>=2.5, PyYAML>=6.0.
Quickstart
import asyncio
from slurmly import SlurmSSHClient, JobSpec
async def main():
async with SlurmSSHClient.connect(
host="login.example.edu",
username="myuser",
key_path="~/.ssh/cluster_ed25519", # absolute paths work too
account="my_allocation",
) as client:
job = await client.submit(JobSpec(
name="hello",
command_template="echo hi from $HOSTNAME",
partition="shared",
time_limit="00:01:00",
))
info = await client.get_job(job.slurm_job_id, submitted_at=job.submitted_at)
print(job.slurm_job_id, info.lifecycle)
asyncio.run(main())
That's the whole API. For polling loops, log tailing, arrays, dependencies, artifacts, and cleanup, see docs/cookbook.md.
Loading from a config file (optional)
If you'd rather keep configuration out of code, SlurmSSHClient.from_config(path) reads
YAML, TOML, or JSON. See docs/configuration.md for the full
schema. Minimal slurmly.yaml:
ssh:
host: login.example.edu
username: myuser
key_path: ~/.ssh/cluster_ed25519 # private key (not .pub)
slurm:
account: my_allocation
# remote_base_dir defaults to ~/slurmly when omitted
async with SlurmSSHClient.from_config("slurmly.yaml") as client:
...
Features
| Capability | Entry point |
|---|---|
| Submit a job | client.submit(spec) |
| Render-only (no SSH) | client.render_only(spec) |
| Cancel / signal | client.cancel(job_id, signal=...) |
| Tail stdout / stderr | client.tail_stdout(job), client.tail_stderr(job) |
| Get a single status | client.get_job(job_id, submitted_at=...) |
| Get many statuses (batched) | client.get_jobs([id1, id2, ...]) |
| Polling helpers | client.poll_job(...), PollingPolicy, is_terminal(...) |
| Capability probe | client.detect_capabilities() |
| Job arrays | JobSpec(array="0-99%10", command_template=...) |
| Typed dependencies | JobDependency(type="afterok", job_ids=[...]) |
| List / download artifacts | client.list_artifacts(job), client.download_artifact(job, ...) |
| Incremental log read / follow | client.read_log(target, offset=...), client.follow_log(target, until=...) |
| Binary-safe download | client.download_file(remote, local), download_artifact(..., binary=True) |
Stateless (no SubmittedJob) |
path-addressable APIs + client.attach(job_id, ...) |
| Plan / execute remote cleanup | client.plan_cleanup(...), client.cleanup(plan) |
| Observability hooks | Subclass SlurmlyHooks, pass to constructor |
| In-memory testing | from slurmly.testing import FakeTransport |
Documentation
| Topic | File |
|---|---|
| API reference | docs/api-reference.md |
| Configuration files (YAML/TOML/JSON) | docs/configuration.md |
| Purdue Anvil guide | docs/anvil.md |
| Cookbook (patterns & recipes) | docs/cookbook.md |
License
MIT.
Metadata
Release files for slurmly 0.5.0
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 |
|---|---|---|---|---|
| slurmly-0.5.0.tar.gz | 75.4 kB | Without provenance | Details for slurmly-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| slurmly-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for slurmly-0.5.0-py3-none-any.whl |
Total release size: 128.6 kB
Release files / slurmly-0.5.0.tar.gz
| Download URL | slurmly-0.5.0.tar.gz |
|---|---|
| Size | 75.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a67a2d9bd15b5cc4455071eec8134db49c38b62b1fb3fcd51ea2a9439db64f9
|
|
BLAKE2b-256 checksum How to use checksums |
fe99a09c88fdd98a41e80374a5da602125b59440c69094c6ad1de42100ecf495
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / slurmly-0.5.0-py3-none-any.whl
| Download URL | slurmly-0.5.0-py3-none-any.whl |
|---|---|
| Size | 53.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0d459504fcbc39d732f72e37d047334449433bb0c7060d8b53fbfcbf8ff2c88
|
|
BLAKE2b-256 checksum How to use checksums |
489fac4651de161afc97aca5255d6880345d1d76e632548e79c99cbffd8817b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for slurmly 0.5.0
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.