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
No AWS account or credentials required — the public hosted endpoint is rate-limited to 100 requests per IP per day. If you self-host and want to keep the Lambda behind IAM auth, install with the optional dependency:
pip install 's2r[iam-auth]'
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
- Client: The
s2rlibrary signs your SLURM script with HMAC-SHA256 (no AWS credentials needed) - API: Sends the signed request to an AWS API Gateway HTTP endpoint
- AI: An AWS Lambda behind the API calls Bedrock (Claude Sonnet 4.6) to perform the conversion
- 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-api-id.execute-api.us-west-2.amazonaws.com/
If you self-host with IAM auth on the endpoint, install the IAM extra and enable signing:
pip install 's2r[iam-auth]'
export S2R_USE_IAM_AUTH=true
export S2R_AWS_REGION=us-west-2
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
- API Reference: Complete API documentation for library and CLI
- Architecture: System design and component details
- Deployment Guide: AWS Lambda deployment instructions
- Troubleshooting: Common issues and solutions
- CLAUDE.md: Quick reference for Claude Code
Current Deployment Status
Deployed in us-west-2:
- API Gateway HTTP API → Lambda
s2r-converter→ Bedrock - Model: Claude Sonnet 4.6 (
us.anthropic.claude-sonnet-4-6cross-region inference profile) - Rate Limit: 100 requests/IP/day (DynamoDB-backed)
- Public endpoint, no AWS credentials required to use the client
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 with API Gateway + Lambda:
git clone https://github.com/dirkpetersen/slurm2runai.git
cd slurm2runai/lambda
# Deploy with SAM (creates API Gateway, Lambda, DynamoDB)
sam deploy --guided
# Point your client at the new endpoint
export S2R_API_ENDPOINT=https://<api-id>.execute-api.<region>.amazonaws.com/
See docs/deployment.md for full instructions.
License
MIT License - see LICENSE file for details.
Contributing
Contributions welcome! Please:
- Open an issue to discuss changes
- Follow the code style (ruff)
- Add tests for new features
- Update documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file s2r-0.3.2.tar.gz.
File metadata
- Download URL: s2r-0.3.2.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcb909600065f2d8f6105b076619b2782189df6dd13dc8209c9f77ac8d79c89b
|
|
| MD5 |
120f001eb1deb2e548c72f2fe840706e
|
|
| BLAKE2b-256 |
fb05a8562dba711e2b4c718fd6666df8d19b1f8508bc666c604af91e2a6279bc
|
Provenance
The following attestation bundles were made for s2r-0.3.2.tar.gz:
Publisher:
publish-pypi.yml on dirkpetersen/slurm2runai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
s2r-0.3.2.tar.gz -
Subject digest:
dcb909600065f2d8f6105b076619b2782189df6dd13dc8209c9f77ac8d79c89b - Sigstore transparency entry: 1497648494
- Sigstore integration time:
-
Permalink:
dirkpetersen/slurm2runai@20dc0b56b873afa7518847bab96473e6d0e5a1f4 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/dirkpetersen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@20dc0b56b873afa7518847bab96473e6d0e5a1f4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file s2r-0.3.2-py3-none-any.whl.
File metadata
- Download URL: s2r-0.3.2-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b859c0d055a307406783a7bbf591b48fecca22b28b5fe7557e8e2ee6d8ae1d5
|
|
| MD5 |
3a0a5eb2bee2a97e8cedac8035ee18c2
|
|
| BLAKE2b-256 |
d6cee9123ab9e3923ae8da9935acd1b9814e25e995d4767f88f11465069a73d5
|
Provenance
The following attestation bundles were made for s2r-0.3.2-py3-none-any.whl:
Publisher:
publish-pypi.yml on dirkpetersen/slurm2runai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
s2r-0.3.2-py3-none-any.whl -
Subject digest:
4b859c0d055a307406783a7bbf591b48fecca22b28b5fe7557e8e2ee6d8ae1d5 - Sigstore transparency entry: 1497648633
- Sigstore integration time:
-
Permalink:
dirkpetersen/slurm2runai@20dc0b56b873afa7518847bab96473e6d0e5a1f4 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/dirkpetersen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@20dc0b56b873afa7518847bab96473e6d0e5a1f4 -
Trigger Event:
release
-
Statement type: