Skip to content

voiage.parallel.distributed.distributed_map

distributed_map([positional or keyword] items: Sequence[Item] | Iterable[Item] = None, [positional or keyword] worker_func: Callable[[Item], ChunkResult] = None, [keyword-only] config: ClusterExecutionConfig | None = None, [keyword-only] n_workers: int | None = None, [keyword-only] use_processes: bool | None = None, [keyword-only] executor_factory: Callable[[int, bool], Executor] | None = None) -> list[ChunkResult]

Execute work across a CPU pool or a caller-supplied distributed executor.

The call preserves input ordering, so the returned list is aligned to the incoming item sequence even when the underlying executor completes tasks out of order.

Parameters:

  • items Sequence[Item] | Iterable[Item]
  • worker_func Callable[[Item], ChunkResult]
  • config ClusterExecutionConfig | None (default: None)
  • n_workers int | None (default: None)
  • use_processes bool | None (default: None)
  • executor_factory Callable[[int, bool], Executor] | None (default: None)

Returns: list[ChunkResult]