Skip to main content

datalad-slurm: A DataLad extension for HPC (slurm) systems

PyPI version Build status codecov.io Documentation Status

Python versions License DOI

datalad-slurm is an extension to the DataLad package for high-performance computing (HPC), specifically slurm systems.

DataLad is a package which facilitates adherence to the FAIR research data management principles.

datalad-slurm sits on top of the main DataLad package, and it is designed to improve the DataLad workflow on HPC systems. The package is aimed at slurm systems due to the prominence of SLURM in HPC settings, but in the future it may be extended to HPC systems more generally.

datalad-slurm makes it easier for users to manage their research data on HPC systems with DataLad, and also solves the following conflicts of DataLad usage in HPC systems:

  • Inefficient sequential sections in highly parallel HPC jobs
  • Critical race conditions between git commands in concurrent jobs

Installation

First, install DataLad and git-annex. This can be done via Linux distribution packages or via Python pip or pipx or in other ways.

The install datalad-slurm with

pip install datalad-slurm

or install from a clone of this repository with

pip install -e .

in a Python virtual env or without one. Note that datalad-slurm does not have datalad as a Python dependency so that it will not force datalad to be installed in the same way.

Example usage

To schedule a slurm script:

datalad slurm-schedule --output=<output_files_or_dir> <slurm_submission_command>

where <output_files_or_dir> are the expected outputs from the job, and <slurm_submission_command> is for example sbatch submit_script. Further optional command line arguments can be found in the documentation.

Multiple jobs (including array jobs) can be scheduled sequentially. They are tracked in an SQLite database. Note that any open jobs must not have conflicting outputs with previously scheduled jobs. This is so that the outputs of each slurm run can be tracked to the slurm job which generated them.

To finish (i.e. post-process) these jobs (once they are complete), simply run:

datalad slurm-finish

Alternatively, to finish a particular scheduled job, run:

datalad slurm-finish <slurm_job_id>

This will create a [DATALAD SLURM RUN] entry in the git log, analogous to a datalad run command.

datalad-slurm will flag an error for any jobs which could not be post-processed, either because they are still running, or the job failed. These are not automatically cleared from the SQLite database. The output files should first be removed or manually added in git, before running

datalad slurm-finish --close-failed-jobs

To clear the SQLite database. To inspect the current status of all open jobs (without saving anything in git), run:

datalad slurm-finish --list-open-jobs

To reschedule a previously scheduled job:

datalad slurm-reschedule <schedule_commit_hash>

where <schedule_commit_hash> is the commit hash of the previously scheduled job. There must also be a corresponding datalad slurm-finish command to the original datalad slurm-schedule, otherwise datalad slurm-reschedule will throw an error.

In the lingo of the original DataLad package, the combination of datalad slurm-schedule + datalad slurm-finish is similar to datalad run, and datalad slurm-reschedule + datalad slurm-finish is similar to datalad rerun.

An example workflow could look like this (constructed deliberately to have some failed jobs):

datalad slurm-schedule -o models/abrupt/gold/ sbatch submit_gold.slurm
datalad slurm-schedule -o models/abrupt/silver/ sbatch submit_silver.slurm
datalad slurm-schedule -o models/abrupt/bronze/ sbatch submit_bronze.slurm
datalad slurm-schedule -o models/abrupt/platinum/ sbatch submit_array_platinum.slurm

Checking the job statuses at some point while they are running:

datalad slurm-finish --list-open-jobs

The following jobs are open: 

slurm-job-id   slurm-job-status
10524442       COMPLETED
10524535       RUNNING
10524556       FAILED
10524620       PENDING

Later, once all the jobs have finished running:

datalad slurm-finish

add(ok): models/abrupt/gold/05_02/slurm-10524442.out (file)                                                                                                                                                         
add(ok): models/abrupt/gold/05_02/slurm-job-10524442.env.json (file)                                                                                                                                                
add(ok): models/abrupt/gold/05_02/model_0.model.gz (file)                                                                                                                                                           
save(ok): . (dataset)                                                                                                                                                                                               
add(ok): models/abrupt/silver/05_02/slurm-10524535.out (file)                                                                                                                                                       
add(ok): models/abrupt/silver/05_02/slurm-job-10524535.env.json (file)                                                                                                                                              
add(ok): models/abrupt/silver/05_02/model_0.model.gz (file)                                                                                                                                                         
add(ok): models/abrupt/silver/05_02/model.scaler.gz (file)                                                                                                                                                          
save(ok): . (dataset)                                                                                                                                                                                               
finish(impossible): [Slurm job(s) for job 10524556 are not complete.Statuses: 10524556: FAILED]                                                                                                                     
finish(impossible): [Slurm job(s) for job 10524620 are not complete.Statuses: 10524620_0: COMPLETED, 10524620_1: COMPLETED, 10524620_2: TIMEOUT]
action summary:
  add (ok: 7)
  finish (impossible: 2)
  save (ok: 2)

To close the failed jobs:

datalad slurm-finish --close-failed-jobs

finish(ok): [Closing failed / cancelled jobs. Statuses: 10524556: FAILED]
finish(ok): [Closing failed / cancelled jobs. Statuses: 10524620_0: COMPLETED, 10524620_1: COMPLETED, 10524620_2: TIMEOUT]
action summary:
finish (ok: 2)

Note that if any sub-job of an array job fails, that whole job is treated as a failed job. The user always has the option to manually commit the successful outputs if desired.

The git history would then appear like so:

git log --oneline

a8e4aa6 (HEAD -> master) [DATALAD SLURM RUN] Slurm job 10524535: Completed
25067fe [DATALAD SLURM RUN] Slurm job 10524442: Completed

With one particular entry looking like:

commit a8e4aa62519db3b5f63243cc925ee918984bf506 (HEAD -> master)
Author: Tim Callow <tim@notmyrealemail.com>
Date:   Tue Feb 18 09:31:47 2025 +0100

    [DATALAD SLURM RUN] Slurm job 10524535: Completed

    === Do not change lines below ===
    {
     "chain": [],
     "cmd": "sbatch submit_silver.slurm",
     "commit_id": null,
     "dsid": "61576cad-ea4f-4425-8f35-16b9955c9926",
     "extra_inputs": [],
     "inputs": [],
     "outputs": [
      "models/abrupt/silver",
      "models/abrupt/silver/05_02/slurm-10524535.out",
      "models/abrupt/silver/05_02/slurm-job-10524535.env.json"
     ],
     "pwd": ".",
     "slurm_job_id": 10524535,
     "slurm_outputs": [
      "models/abrupt/silver/05_02/slurm-10524535.out",
      "models/abrupt/silver/05_02/slurm-job-10524535.env.json"
     ]
    }
    ^^^ Do not change lines above ^^^

Contributing

The datalad-slurm extension is still in the very early stages of development. We welcome contributors and testers of the package. Please document any issues on GitHub and we will try to resolve them.

See CONTRIBUTING.md if you are interested in internals or contributing to the project.

Metadata

Release files for datalad-slurm 0.2.7

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

Source distribution (sdist)

Source distribution for datalad-slurm 0.2.7
File Size Uploaded Provenance Actions
datalad_slurm-0.2.7.tar.gz 69.5 kB With provenance Details for datalad_slurm-0.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datalad-slurm 0.2.7
File Interpreter ABI Platform Actions
datalad_slurm-0.2.7-py3-none-any.whl Python 3 none any Details for datalad_slurm-0.2.7-py3-none-any.whl

Total release size: 106.9 kB

Release files / datalad_slurm-0.2.7.tar.gz

Download URL datalad_slurm-0.2.7.tar.gz
Size 69.5 kB
Tags Source
SHA-256 checksum
How to use checksums
54e3c94fdb3dcc00846333d8ad56bdb6060e92dbe25beecd07829bde6799ed55
BLAKE2b-256 checksum
How to use checksums
e67fa7a1e488e56a52f9386a454cb52e2b7b33a93a674779fce7b392bd171d3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / datalad_slurm-0.2.7-py3-none-any.whl

Download URL datalad_slurm-0.2.7-py3-none-any.whl
Size 37.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97f4ec4ded636b930c63e4afd6e6a5673e1adbd1dc72b7593ac5960ef9fb8333
BLAKE2b-256 checksum
How to use checksums
6ca2a81e128ffa98352d3f4f848905cd2b803066374506f1d3c55f8e3ece8578
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Security for datalad-slurm 0.2.7

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for datalad_slurm-0.2.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

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