quri_parts.core.utils.concurrent module#

execute_concurrently(fn, common_input, individual_inputs, executor=None, concurrency=1)#

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().

Parameters:
  • fn (Callable[[T_common, Sequence[T_individual]], Iterable[R]]) –

  • common_input (T_common) –

  • individual_inputs (Iterable[T_individual]) –

  • executor (Optional['Executor']) –

  • concurrency (int) –

Return type:

Sequence[R]