Skip to main content

Run commands on SLURM as if local with seamless detach/reattach

Project description

slrun - SLURM Tools

Run commands on SLURM as if they were local, with seamless detach/reattach capabilities.

Features

  • Seamless job submission: Run commands on SLURM with minimal syntax changes
  • Real-time output streaming: See stdout/stderr as if running locally
  • Detach/reattach capability: Start a job, detach, and reconnect later
  • Job management: List all detached jobs and their statuses
  • Configuration profiles: Store different resource configurations in config file
  • Automatic cleanup: Temporary files are removed when jobs complete

Installation

Using UV (recommended)

uv add slrun

Directly from GitHub

uv pip install git+https://github.com/yashsavani/slrun.git

Using pip

pip install slrun

Quick Start

Launch a job

slrun launch python train_model.py --epochs 100

With custom SLURM resources

slrun launch --mem 128GB --time 2-00:00:00 --gres gpu:A100:2 python train_model.py

Using a configuration profile

slrun launch --profile large python train_model.py

Handling argument conflicts

When your command uses arguments that might conflict with slrun, use the -- separator:

slrun launch --timeout 7200 -- python script.py --timeout 3600

List all detached jobs

slrun list

Reattach to a job

slrun attach 12345  # Replace with your job ID

Configuration

You can customize default settings by creating a configuration file:

# Edit your configuration file
slrun config edit

# View your current configuration
slrun config show

Example configuration (~/.slrun/config.toml):

[defaults]
time = "2-00:00:00"
mem = "128GB"
gres = "gpu:A100:1"

[profiles.large]
time = "7-00:00:00"
mem = "256GB"
gres = "gpu:A100:4"

[profiles.debug]
time = "0-01:00:00"
mem = "16GB"
gres = "gpu:K80:1"

Development

Local Development Setup

# Clone the repository
git clone https://github.com/yashsavani/slrun.git
cd slurm-tools

# Install in development mode
uv pip install -e .

Building the Package

uv build

Documentation

For complete usage instructions, see the detailed documentation.

Requirements

  • Python 3.6+
  • Access to a SLURM cluster with sbatch, squeue, and sacct commands

License

MIT

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

slrun-0.1.4.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

slrun-0.1.4-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file slrun-0.1.4.tar.gz.

File metadata

  • Download URL: slrun-0.1.4.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for slrun-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a97fe9d2c865a113e0d3ee7021dcf984b7d553f9809f0b2af93a8d982137555d
MD5 a6eaf8469b3f8729d1dff94ffcb342ce
BLAKE2b-256 ebaebf38f124d13499c4968c9e542c8d55fe17dafec367cbff882c6699e1951a

See more details on using hashes here.

File details

Details for the file slrun-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: slrun-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for slrun-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 70342207a23154f432fdc14ef1fe41ee9ba2593dcdc8a285a5c6f8cc5ac7f15d
MD5 68f6af510cd33c57ab58e5a2a1fb450b
BLAKE2b-256 4f5c357edf6290f922c7ae0e36fd7f568095b26624c9b7b9d2f6ecaa0b023021

See more details on using hashes here.

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