Skip to main content

Convert SLURM submit scripts to Run.ai configurations using AI

Project description

s2r - SLURM to Run.ai Converter

Convert SLURM batch scripts to Run.ai configurations using AI.

Installation

pip install s2r

Quick Start

CLI Usage

# Convert file: saves job.yaml, prints runai CLI command to stdout
s2r job.slurm

# Convert file: saves output.yaml only (no CLI output)
s2r job.slurm output.yaml

# Convert from stdin: prints runai CLI command to stdout (no file)
s2r < my_slurm_script.sh

Library Usage

from s2r import convert_slurm_to_runai

slurm_script = """
#!/bin/bash
#SBATCH --job-name=my-job
#SBATCH --gres=gpu:2
#SBATCH --mem=32G

python train.py
"""

runai_config = convert_slurm_to_runai(slurm_script)
print(runai_config)

How It Works

  1. Client: The s2r library signs your SLURM script with HMAC-SHA256
  2. API: Sends the signed request to an AWS Lambda endpoint
  3. AI: Lambda calls AWS Bedrock (Claude) to perform the conversion
  4. Response: Returns the Run.ai YAML configuration or CLI commands

Features

  • Free to use: The service is provided at no cost (rate-limited)
  • Secure: Signed requests prevent unauthorized API usage
  • Rate-limited: 100 requests per IP per day
  • Simple: Works with stdin, files, or as a library

Configuration

By default, the tool uses a public API endpoint. If you're deploying your own:

export S2R_API_ENDPOINT=https://your-lambda-url.lambda-url.us-east-1.on.aws/

Example

Given this SLURM script:

#!/bin/bash
#SBATCH --job-name=pytorch-training
#SBATCH --nodes=1
#SBATCH --cpus-per-task=8
#SBATCH --mem=32G
#SBATCH --gres=gpu:2
#SBATCH --time=24:00:00

python train.py --epochs 100

The tool will generate an equivalent Run.ai configuration with:

  • GPU resource requests (2 GPUs)
  • CPU and memory allocations
  • Job name and command
  • Appropriate container/image specifications

Documentation

Current Deployment Status

Deployed Lambda Function (us-west-2):

  • Model: Claude Sonnet 4.5 (20250929)
  • Rate Limit: 100 requests/IP/day

Known Issues:

  • Lambda Function URL auth type needs to be changed from AWS_IAM to NONE (aws lambda update-function-url-config --function-name s2r-converter --auth-type NONE)
  • See troubleshooting guide for resolution

Development

See CLAUDE.md for development commands and quick reference.

For detailed architecture and deployment information, see the docs/ directory.

Self-Hosting

To deploy your own instance:

# Clone repository
git clone https://github.com/yourusername/slurm2runai.git
cd slurm2runai

# Deploy Lambda function
cd lambda
python3 -m zipfile -c lambda.zip lambda_function.py
aws lambda create-function --function-name s2r-converter ...

# See https://github.com/dirkpetersen/slurm2runai/blob/main/docs/deployment.md for full instructions

License

MIT License - see LICENSE file for details.

Contributing

Contributions welcome! Please:

  1. Open an issue to discuss changes
  2. Follow the code style (ruff)
  3. Add tests for new features
  4. Update documentation

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

s2r-0.3.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

s2r-0.3.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file s2r-0.3.0.tar.gz.

File metadata

  • Download URL: s2r-0.3.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for s2r-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6e9eb2118f7d732adcdc13ed6381c82616bc34ffc246c5373bb454df602143dc
MD5 f86936b6f960f553cd9e36aedf0cab22
BLAKE2b-256 d55713d4742d345c0734e5ab484fc36c3fa1ae7b790a2b947e36ef05abf6def1

See more details on using hashes here.

Provenance

The following attestation bundles were made for s2r-0.3.0.tar.gz:

Publisher: publish-pypi.yml on dirkpetersen/slurm2runai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file s2r-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: s2r-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for s2r-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f2334d696063dcf388f659ddeefd13ec5ecef32e1183123c14b334186cfee0e
MD5 bc0efc6b1d7f3d058be605efa1ab7593
BLAKE2b-256 f697d2a1c0ce8cfecc388400962c9fa9b66e21d10ac0c21c9f9dfd7f7ef6fde2

See more details on using hashes here.

Provenance

The following attestation bundles were made for s2r-0.3.0-py3-none-any.whl:

Publisher: publish-pypi.yml on dirkpetersen/slurm2runai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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