Asynchronous SLURM REST requests with proxy support.
Project description
slurm-requests
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.
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
slurm_requests-0.0.2.tar.gz
(14.2 kB
view details)
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 slurm_requests-0.0.2.tar.gz.
File metadata
- Download URL: slurm_requests-0.0.2.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18d25f41577c721d8c5967a537eab2174208cd616a2e8cfbd362daf096378db6
|
|
| MD5 |
e3511a0b308f23fcc35bb1fd1751faa1
|
|
| BLAKE2b-256 |
1d5b24bbbfd9485e47b5c358ca15778f1bbc94dccee749ae565e7a88f9a1f019
|
File details
Details for the file slurm_requests-0.0.2-py3-none-any.whl.
File metadata
- Download URL: slurm_requests-0.0.2-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fe9f15a029f3ad9f1bb067d80ae811bf4a2502be1dc621ab0af3e96336544e2
|
|
| MD5 |
f3096b57db1827cd8f8bbac3ea52ae0b
|
|
| BLAKE2b-256 |
41c8b70eba696dd92ce56a6f218b039bc2fe89f8d4b595666765c257f08c8a50
|