quri_parts.core.utils.concurrent module#

quri_parts.core.utils.concurrent.execute_concurrently(fn: Callable[[T_common, Sequence[T_individual]], Iterable[R]], common_input: T_common, individual_inputs: Iterable[T_individual], executor: Executor | None = None, concurrency: int = 1) Sequence[R]#

Execute the given function for each input concurrently and returns all the results as a sequence.

If executor is None, the executions are performed in sequence. If an executor is given, the function is executed for each input concurrently using Executor.map().