Parallel
Generated from the type stubs and docstrings. Do not edit by hand.
ForkSafetyError
Section titled “ForkSafetyError”par_map was called in an unsafe state to fork (threads alive / nested).
ParMapError
Section titled “ParMapError”Aggregate of element failures from a par_map call (on_error="raise").
errors is list[tuple[int, str]] (input index, formatted traceback), sorted
by input index; partial is the container of successful results (same type as a
normal return), with error slots holding a sentinel (0.0 / 0 / None) - read
errors for which.
Fields:
errors = errors if errors is not None else []partial = partial
RegionOverflowError
Section titled “RegionOverflowError”Object-path results overflowed a worker’s result region.
WorkerDiedError
Section titled “WorkerDiedError”A worker exited before completing its chunk (crash, os._exit, signal).
Functions
Section titled “Functions”par_map
Section titled “par_map”par_map(fn: Callable[[Any], Any], data: ParMapData, workers: Optional[int] = None, chunk_size: Optional[int] = None, timeout: Optional[float] = None, on_error: str = 'raise', result_codec: Any = _UNSET, result_type: Optional[type] = None, region_size: Optional[int] = None, initializer: Optional[Callable[..., Any]] = None, initargs: Sequence[Any] = (), unsafe_allow_threads: bool = False) -> ParMapResultRun fn over data across forked worker processes (real parallelism).
fn runs in a forked child process - treat it as pure; mutations to
globals, closures, or shared state are applied in the child and silently
lost. See the docsite for dispatch-by-input-type, result_codec/
result_type, RNG/GC caveats, and initializer details.
Raises NotImplementedError without os.fork (e.g. Windows),
ForkSafetyError for a live-thread or nested-worker call, ValueError
for a bad option combination, ParMapError (or its WorkerDiedError/
RegionOverflowError subclasses) for element failures under
on_error="raise", and TimeoutError past timeout.