Slurmer
This package is designed to run heavy loads in a computer cluster. Supported task schedulers are:
- Running on a single node
- SLURM
PRs to add more schedulers are welcome.
Features
- Run multiple tasks in parallel.
- Run tasks in randomised order but consistently in multiple computing nodes.
- Consistent pipeline to work with heavy tasks (directory creation, handling errors, postprocessing...)
Example
You can find the documentation here.
The package can be used as follows:
from dataclasses import dataclass
from pathlib import Path
from typing import Iterator
import slurmer
@dataclass
class MyTaskParameters(slurmer.TaskParameters):
processing_id: int
@dataclass
class MyTaskResult(slurmer.TaskResult):
good_result: bool
class MyTask(slurmer.Task):
def __init__(self, min_job: int, max_job: int):
super().__init__()
self.min_job = min_job
self.max_job = max_job
def generate_parameters(self) -> Iterator[MyTaskParameters]:
for i in range(self.min_job, self.max_job):
yield MyTaskParameters(processing_id=i)
def make_dirs(self):
# Dirs are created before the task is run
for i in range(self.min_job, self.max_job):
Path(f"out/result_{i}").mkdir(parents=True, exist_ok=True)
def process_function(self, parameters: MyTaskParameters) -> MyTaskResult:
# Run your heavy code here
for i in range(parameters.processing_id, parameters.processing_id + 10):
print(f"Processing {i}")
return MyTaskResult(good_result=True)
def process_output(self, result: MyTaskResult) -> bool:
# Postprocess output, this is NOT run in parallel and only handles the tasks run
# in the current node. If you want to postprocess everything wait for all the nodes
# to finsish computing.
#
# This function should check whether the output is the "expected" one and return True
# if something went wrong.
return not result.good_result
Then in your main script:
>>> task = MyTask(min_job=1, max_job=10)
>>> task.execute_tasks()
Metadata
Release files for slurmer 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| slurmer-1.0.7.tar.gz | 6.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| slurmer-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / slurmer-1.0.7.tar.gz
| Download URL | slurmer-1.0.7.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a737c9045aa8acd4f8d982ac01b289952595228172335b449e5787c206a80940
|
|
BLAKE2b-256 checksum How to use checksums |
08479194c7badd178593cb8c687b5d24eefda50bac0c3f420449637bd054d154
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure
|
Release files / slurmer-1.0.7-py3-none-any.whl
| Download URL | slurmer-1.0.7-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fb57787f003c66c96f99323857ffaf668659fdc23cba5a0a7a53011ba54377d
|
|
BLAKE2b-256 checksum How to use checksums |
c27e0bf430a1f6e55edd8edde1de720b69e97a01f27805fae816b8865bdb3588
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure
|
Security for slurmer 1.0.7
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.