Small wrapper around submitit to simplify cluster submissions
Project description
resubmit
Small utility library to simplify job submission with Submitit on SLURM clusters.
Quick usage:
- Install locally for development:
pip install -e .[debug]
- Use in your project:
from resubmit import submit_jobs, maybe_attach_debugger
# attach remote debugger if requested
maybe_attach_debugger(args.get("port", None))
# submit jobs (list of dicts)
submit_jobs(jobs_list, my_entrypoint, timeout_min=60, block=True)
API
submit_jobs(...) 🔧
Submit multiple jobs to a Slurm cluster using Submitit.
Signature (short):
submit_jobs(jobs_args: Iterable[dict], func: Callable[[List[dict]], Any], *, timeout_min: int, cpus_per_task: int = 16, mem_gb: int = 64, num_gpus: int = 1, account: Optional[str] = None, folder: str = "logs/%j", block: bool = False, prompt: bool = True, local_run: bool = False, slurm_additional_parameters: Optional[Dict] = None, constraint: Optional[str] = None, reservation: Optional[str] = None)
jobs_args: iterable of per-job kwargs (each item is passed tofunc).func: entrypoint called for each job (should accept a list or single job dict depending on your usage).timeout_min,cpus_per_task,mem_gb,num_gpus: common Slurm resources.account: optional Slurm account name.folder: logs folder for Submitit files (supports%jfor job id).block: if True, waits for all jobs and returns results.prompt: if True, asks for confirmation interactively; set toFalsefor CI or tests.local_run: run the jobs locally without Submitit (useful for debugging).slurm_additional_parameters: pass any extra Slurm key/value pairs to Submitit.constraint/reservation: cluster-specific options kept out of defaults — provide them explicitly if you need them (they take precedence over values inslurm_additional_parameters).
Example:
submit_jobs(
jobs_list,
my_entrypoint,
timeout_min=60,
num_gpus=2,
prompt=False,
constraint="gpu",
)
maybe_attach_debugger(port: Optional[int]) 🐞
Attach debugpy to the job when port is provided (> 0). Safe no-op if port is None or <= 0.
- If
debugpy(andsubmitit) are not available on the node, aRuntimeErroris raised with an explanatory message.
Example:
# attach remote debugger only when a port is provided (e.g., from CLI args)
maybe_attach_debugger(args.get("port"))
Tips:
- Use
prompt=Falsewhen callingsubmit_jobsfrom scripts or CI to avoid interactive prompts. - Tests demonstrate non-interactive behavior (
prompt=False) and optionalconstraint/reservationhandling.
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
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 resubmit-0.0.8.tar.gz.
File metadata
- Download URL: resubmit-0.0.8.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66ed59b42c88ee2dac456eec1aef1e8746a6d0af012e65ecbc7fa4b3a0fc41a1
|
|
| MD5 |
2a15bb3ab90dfd766507f284857f2664
|
|
| BLAKE2b-256 |
0978ef3b050d5eb9f369321da1ae11f84d9cfe66cf9a720bb640afed76f44223
|
File details
Details for the file resubmit-0.0.8-py3-none-any.whl.
File metadata
- Download URL: resubmit-0.0.8-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
011a88591db504fbafa82c02d96b6d1802daf3f8a6dfae8046947ecae62aac30
|
|
| MD5 |
52e1cf6965cdb39691ac053ae34cafd0
|
|
| BLAKE2b-256 |
f8fc50fa84a9ad08747c924b6c8b3917009f7efa5d7bf94134a5ec628a84d15c
|