Skip to main content

SLURM utilities for Python

Project description

pyslurmutils

SLURM utilities for Python.

Demo

Get an access token on rnice

export SLURM_TOKEN=$(scontrol token lifespan=3600)
export SLURM_URL=...
export SLURM_USER=...

Run any of the example scripts

python3 scripts/examples.py

Run the tests (CI or locally)

python3 -m pytest .

When SLURM_TOKEN, SLURM_URL or SLURM_USER is missing it will mock the SLURM clients.

Execute a python function on SLURM

Execute a function on SLURM with an API similar to python's concurrent.futures

from pyslurmutils.concurrent.futures import SlurmRestExecutor

with SlurmRestExecutor(
    url,
    user_name,
    token,
    log_directory="/path/to/log",  # for log files
    data_directory="/path/to/data",  # TCP when not provided
    pre_script="module load ewoks",  # load environment
    python_cmd="python",
) as pool:

    future = pool.submit(sum, [1, 1])
    assert future.result() == 2

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

pyslurmutils-0.1.1.tar.gz (19.7 kB view details)

Uploaded Source

File details

Details for the file pyslurmutils-0.1.1.tar.gz.

File metadata

  • Download URL: pyslurmutils-0.1.1.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for pyslurmutils-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a23aa41da3092072f10fc57bae7d3a31703742ba322437751ed1acf99f07be41
MD5 3893b0007103f6bd7d71bb31e45887d7
BLAKE2b-256 f5f360b7f658418844a0d047c0b7ea57977ea9299517ce3da1f3bd43033556c0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page