Skip to main content

slurm-requests

PyPI - Version PyPI - Python Version


Lightweight asynchronous SLURM REST requests with proxy support.

Installation

pip install slurm-requests

Usage

import asyncio

import slurm_requests as slurm


async def main():

    # set defaults to avoid repetition
    slurm.init_defaults(
        url="https://example.com/sapi",
        api_version="v0.0.40",
        user_name="example_user",
        user_token="example_token",
        partition="example_partition",
        # constraints="GPU",
        environment=["EXAMPLE_VAR=example_value"],
        # headers={"X-Example-Header": "example_value"},
        # proxy_url="socks5://localhost:8080",
    )

    # check connection + credentials
    await slurm.ping()
    await slurm.diagnose()

    # submit
    job_id, _ = await slurm.job_submit(
        name="example_job",
        working_directory="/home/example_user/slurm",
        script="#!/usr/bin/bash\necho Hello, SLURM!",
        # time_limit=60,
        # dependency="afterok:123456",
    )
    assert job_id is not None

    # check state
    response = await slurm.job_current_state_and_reason(job_id=job_id)
    assert response is not None
    state, reason = response
    print(f"Job {job_id} is currently in state '{state}' due to reason '{reason}'.")

    # cancel
    await slurm.job_cancel(job_id=job_id)

    # advanced: overwrite a default (works for all functions)
    await slurm.ping(user_name="dummy", dry_run=True)


if __name__ == "__main__":
    asyncio.run(main())

License

slurm-requests is distributed under the terms of the CC-BY-SA-4.0 license.

Metadata

Release files for slurm-requests 2.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slurm-requests 2.3.1
File Size Uploaded Provenance Actions
slurm_requests-2.3.1.tar.gz 14.4 kB Without provenance Details for slurm_requests-2.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for slurm-requests 2.3.1
File Interpreter ABI Platform Actions
slurm_requests-2.3.1-py3-none-any.whl Python 3 none any Details for slurm_requests-2.3.1-py3-none-any.whl

Total release size: 27.3 kB

Release files / slurm_requests-2.3.1.tar.gz

Download URL slurm_requests-2.3.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0ec79ae2fec7b48005dcf1f2f114a419133719c33db25df0b27d28cdf478432f
BLAKE2b-256 checksum
How to use checksums
6f2cfa244ad2c730186cf8634a0ebe086011a624e5bc94d777b550b799f76fe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release files / slurm_requests-2.3.1-py3-none-any.whl

Download URL slurm_requests-2.3.1-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a55484a7c531f723675d2b5332effaf20d56f0e12440c2374fa51ad18200164c
BLAKE2b-256 checksum
How to use checksums
8a7c2a2e3570f134aa949dfc1cd1fe873a8ec3a4cebf37ae613aec961b4934a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Security for slurm-requests 2.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page