Skip to content

yggdrasil.pyutils.parallel

parallel

Parallel execution decorator utilities.

parallelize

parallelize(
    executor_cls: Type[Executor] = cf.ThreadPoolExecutor,
    *,
    max_workers: int | None = None,
    arg_index: int = 0,
    timeout: float | None = None,
    return_exceptions: bool = False,
    show_progress: bool = False
) -> Callable[[Callable[P, R]], Callable[P, Iterator[R]]]

Decorator to parallelize a function/method over one iterable argument using a concurrent.futures.Executor.

Returns

A wrapper that returns an iterator (generator) of results, not a list.