Skip to content
Pyrula
Pre-release: the packages are not on PyPI yet, so pip install does not resolve. Build from source to try it today.

Parallel

Generated from the type stubs and docstrings. Do not edit by hand.

par_map was called in an unsafe state to fork (threads alive / nested).


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

Object-path results overflowed a worker’s result region.


A worker exited before completing its chunk (crash, os._exit, signal).

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) -> ParMapResult

Run 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.