Registry / devops / submitit

submitit

JSON →
library1.5.4pypypi✓ verified 23d ago

Submitit is a Python 3.8+ toolbox developed by Facebook Incubator for submitting jobs to Slurm clusters, as well as providing a local executor for testing. It simplifies the process of dispatching Python functions to compute nodes, managing job states, and retrieving results. The current version is 1.5.4, and it sees active maintenance with occasional releases.

pip install submitit
INSTALL
IMPORT
SIG · SUBMITIT
S
submitit
devopspythonv1.5.4
Install
1.7s avg
Import
319ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.5.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.340s · 18.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.298s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AutoExecutor
from submitit import AutoExecutor
The primary entry point for automatically selecting between Slurm or Local executors.
SlurmExecutor
from submitit import SlurmExecutor
Used for explicitly submitting jobs to a Slurm cluster.
LocalExecutor
from submitit import LocalExecutor
Used for explicitly running jobs on the local machine (useful for debugging).

This quickstart demonstrates how to use `submitit.AutoExecutor` to submit Python functions as jobs. It showcases configuring an executor, defining a simple function, submitting multiple jobs in a batch, and retrieving their results. The `AutoExecutor` intelligently switches between Slurm and local execution based on the environment.

import submitit import time import os def my_function(x): time.sleep(0.1) # Simulate some work print(f"Hello from job! Input: {x}, PID: {os.getpid()}") return x * x # Configure a log folder for submitit to store job information # The %j placeholder will be replaced by the Slurm job ID log_folder = os.path.join(os.getcwd(), "submitit_logs", "%j") # Use AutoExecutor, which selects SlurmExecutor if a Slurm environment # is detected, otherwise falls back to LocalExecutor. executor = submitit.AutoExecutor(folder=log_folder) # Set Slurm parameters (these are ignored by LocalExecutor) executor.update_parameters(timeout_min=5, slurm_array_parallelism=2) # Submit jobs within a batch context with executor.batch(): jobs = [] for i in range(5): job = executor.submit(my_function, i) jobs.append(job) print(f"Submitted {len(jobs)} jobs. Waiting for results...") # Retrieve results (blocks until all jobs are complete) outputs = [job.result() for job in jobs] print(f"All jobs completed. Results: {outputs}")
submitit --version
Debug
Known issues
breakingSubmitit 1.2.0 changed how job preemption vs. timeout is detected for Slurm jobs. This was in response to a regression in Slurm versions (between 19.04 and 20.02) and might alter the behavior or reporting for long-running or pre-empted jobs compared to older `submitit` versions.
fix
Review job logs and `submitit`'s internal state for jobs that are expected to be pre-empted or timed out. Adapt your application's logic if it relied on the previous detection mechanism. Ensure your Slurm environment is consistent.
affects: >=1.2.0
breakingSubmitit 1.2.0 introduced fixes for quoting paths in various internal operations. If your code or Slurm configurations previously relied on specific (and possibly incorrect) path handling, this update might cause previously working but malformed paths to now fail explicitly or behave differently due to correct quoting.
fix
Inspect any file paths or directory paths passed to `submitit` or configured in Slurm scripts. Ensure they are correctly formatted and do not contain characters that might have been misinterpreted before the quoting fixes.
affects: >=1.2.0
gotchaThe `submitit.AutoExecutor` dynamically chooses between `SlurmExecutor` and `LocalExecutor` based on the environment (e.g., presence of `SLURM_JOB_ID` or Slurm executables). This can lead to unexpected local execution when a Slurm environment is assumed but not active, potentially consuming local resources or not fulfilling HPC requirements.
fix
For production or critical workloads, explicitly use `submitit.SlurmExecutor` or `submitit.LocalExecutor` to guarantee the desired execution environment. Always test `AutoExecutor` behavior in your target environments to understand its fallback logic.
affects: All
gotchaSubmitit extensively uses `cloudpickle` for serializing functions and their arguments across processes. Complex objects, lambda functions capturing intricate state, or non-picklable resources (e.g., open file handles, database connections) passed to submitted functions will often lead to serialization errors.
fix
Ensure all arguments passed to `executor.submit()` are standard Python types or custom classes that are fully `cloudpickle`-compatible. For complex setups, consider passing file paths to data or configuration instead of directly passing objects, allowing the job to load resources within its own context.
affects: All
Errors
Common errors & fixes
_pickle.PicklingError: Can't pickle <function ...>` or `AttributeError: Can't pickle local object '...'
The function, or an object it depends on, that is being submitted to the executor is not pickleable (e.g., a nested function, lambda, or an unpicklable object instance).
fix
Ensure all functions and their arguments passed to `executor.submit()` are defined at the top-level of a module, are static methods, or are otherwise robustly pickleable. Avoid using local functions or lambdas directly.
ModuleNotFoundError: No module named 'submitit.core'
Attempting to import executor classes (like `SlurmExecutor`) from the internal `submitit.core` module, which is not part of the public API and may not exist in newer versions or expected paths.
fix
Import executor classes directly from the top-level `submitit` package: `from submitit import SlurmExecutor, AutoExecutor, LocalExecutor`.
Permission denied: '<path_to_log_folder>'
The user running the `submitit` script does not have sufficient write permissions to the specified log folder for the executor.
fix
Either change the log folder to a path where the user has write permissions, or modify the permissions of the existing log folder to allow writing.
ModuleNotFoundError: No module named 'your_project_module' (appearing in Slurm job output files like submitit-slurm_logs/%j_log.out)
The Python environment on the Slurm compute node executing the job does not have all the required dependencies (or the specific project module) installed or activated.
fix
Ensure the Slurm job's execution environment includes all necessary packages. This can be done by activating a Conda or virtual environment within the Slurm job (e.g., using `pre_cmd` in `slurm_options`) or by installing dependencies directly on the compute nodes.
Upgrade
Version history
1.5.4latest on PyPI · released Dec 17, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
22
OpenAI (training)
1
Resources
submitit — pip install submitit · libregistry