Skip to main content

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 to func).
  • 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 %j for job id).
  • block: if True, waits for all jobs and returns results.
  • prompt: if True, asks for confirmation interactively; set to False for 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 in slurm_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 (and submitit) are not available on the node, a RuntimeError is 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=False when calling submit_jobs from scripts or CI to avoid interactive prompts.
  • Tests demonstrate non-interactive behavior (prompt=False) and optional constraint/reservation handling.

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

resubmit-0.0.10.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

resubmit-0.0.10-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file resubmit-0.0.10.tar.gz.

File metadata

  • Download URL: resubmit-0.0.10.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for resubmit-0.0.10.tar.gz
Algorithm Hash digest
SHA256 c77cd77d9dc1a480cbea414cd7b00f06e1aafcea3d32c6a1d987732f1d180867
MD5 3dd47792f068004ad98ba3a1a79d60e0
BLAKE2b-256 9809806d6fc65f4b9608fde472e46d601b4f56d3f1abdca9eca962df39200a87

See more details on using hashes here.

File details

Details for the file resubmit-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: resubmit-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for resubmit-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 83a4f65156b4dee4c3b2c2c79b7545377df3192f0db769c5bccf72b79792cf82
MD5 8911adefc1fad78184e331bb814ee56c
BLAKE2b-256 c2c52c5fd7d9b1fb2d764e45702a3cbc4c7560cfb80d9ec0d52e882e5081291c

See more details on using hashes here.

Supported by

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