Skip to main content

A library for transparent execution of heavy Python jobs on SLURM!

Project description

[!WARNING]
This project is under heavy development and it is in very early stage. It may contain a ton of bugs!

Slurm Executor robot

A library for transparent execution of heavy Python jobs on SLURM!

Imagine being able to offload any* Python function to a HPC cluster with just few lines of code!

No more logging into a cluster, git pulling, troubleshooting and other headaches.

(* or at least any function that cloudpickle can serialize)

Just define your expected pipeline:

remote = os.getenv("SLURM_REMOTE")
port = os.getenv("SLURM_PORT")
user = os.getenv("SLURM_USERNAME")
cpu_partition = os.getenv("CPU_PARTITION")

pipeline = Pipeline(
    steps=[
        RSyncWorkspace(
            local_root="./",
            remote_root=f"/home/{user}/remote_job/",
            exclude_from="rsync-exclude.txt",
            direction="to_remote",
        ),
        SendCall(),
        SendSbatchScript(
            partition=cpu_partition,
            time="00:05:00",
        ),
        SubmitSbatchScript(output_file_location=f"/home/{user}/remote_job/job.out"),
        WaitForJobCompletion(poll_interval_ms=1000),
        ExecuteCommand(remote_command=f"ls /home/{user}/remote_job/"),
        RSyncWorkspace(
            local_root="./",
            remote_root=f"/home/{user}/remote_job/",
            include_only="rsync-include.txt",
            direction="from_remote",
        ),
    ],
    connection_config=ConnectionConfig(
        host=remote,
        user=user,
        port=int(port),
    ),
)

Decorate your function:

from your_code import heavy_data_load, heavy_data_process, heavy_data_save
import os

@pipeline.remote_run
def heavy_step(input_file, output_file):
    data = heavy_data_load()
    processed = heavy_data_process(data)
    heavy_data_save(remote=os.getenv('s3://my_bucket'))

And watch how seamlessly you can execute remote jobs without leaving your local IDE!

Core features:

  • Blazingly fast repository synchronization between machines using rsync compression
  • Safe serialization of functions with cloudpickle
  • Automatic transferring of logs from remote job right into your local terminal
  • Deep integration with familiar SLURM CLI: sbatch, sinfo, sacct
  • Full customization of sbatch script, job resources, setting up environment and remote execution
  • Easy pipeline composition to satisfy various use cases and HPC cluster setups.
  • And more to come...!

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

slurm_executor-0.2.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

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

slurm_executor-0.2.0-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file slurm_executor-0.2.0.tar.gz.

File metadata

  • Download URL: slurm_executor-0.2.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.5

File hashes

Hashes for slurm_executor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dd3c5a0f12d44b7963d471f57d43f31d254a021f3209a80b319833e01de23645
MD5 98977766243f710143cd2eadc6139cd9
BLAKE2b-256 05ce868e7b81f75c7ac5fb238d4518a0faba340e771d742546eb6a9e496f993c

See more details on using hashes here.

File details

Details for the file slurm_executor-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for slurm_executor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebd274a4dd3876a9afed5da0a32ecc91cd677b381226a555eef271e075ce1cad
MD5 ff3a0c759b69facf6719eeaad6f45e18
BLAKE2b-256 e7c87dae0ec5640d92e36b24a7462ce161bfd2e56ce46eda432a343e3ebdc37f

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