taps.executor.dask¶
DaskDistributedExecutor
¶
DaskDistributedExecutor(
client: Client,
*,
wait_for_workers: int | None = None,
wait_for_workers_timeout: float | None = None
)
Bases: Executor
Dask task execution engine.
Parameters:
-
client
(Client
) –Dask distributed client.
-
wait_for_workers
(int | None
, default:None
) –Wait for
n
workers to connect to the scheduler before. Useful when connecting to a remote scheduler; a local cluster created by the client already ensures workers are connected. -
wait_for_workers_timeout
(float | None
, default:None
) –Maximum seconds to wait for workers to connect to the scheduler.
Source code in taps/executor/dask.py
submit
¶
Schedule the callable to be executed.
Parameters:
-
function
(Callable[P, T]
) –Callable to execute.
-
args
(args
, default:()
) –Positional arguments.
-
kwargs
(kwargs
, default:{}
) –Keyword arguments.
Returns:
Source code in taps/executor/dask.py
map
¶
map(
function: Callable[P, T],
*iterables: Iterable[args],
timeout: float | None = None,
chunksize: int = 1
) -> Iterator[T]
Map a function onto iterables of arguments.
Parameters:
-
function
(Callable[P, T]
) –A callable that will take as many arguments as there are passed iterables.
-
iterables
(Iterable[args]
, default:()
) –Variable number of iterables.
-
timeout
(float | None
, default:None
) –The maximum number of seconds to wait. If None, then there is no limit on the wait time.
-
chunksize
(int
, default:1
) –Sets the Dask batch size.
Returns:
-
Iterator[T]
–An iterator equivalent to:
map(func, *iterables)
but the calls may be evaluated out-of-order.
Source code in taps/executor/dask.py
shutdown
¶
Shutdown the client.
Source code in taps/executor/dask.py
DaskDistributedConfig
¶
Bases: ExecutorConfig
DaskDistributedExecutor
plugin configuration.
Parameters:
-
name
(Literal[str]
, default:'dask'
) –Executor name.
-
scheduler
(str | None
, default:None
) –Dask scheduler address.
-
use_threads
(bool
, default:False
) –Use threads instead of processes for dask workers.
-
workers
(int | None
, default:None
) –Maximum number of dask workers.
-
daemon_workers
(bool
, default:True
) –Configure if workers are daemon.
-
wait_for_workers
(int | None
, default:None
) –Wait for N workers to connect before starting. Useful when connecting to a remote scheduler.
-
wait_for_workers_timeout
(float | None
, default:None
) –Timeout (seconds) for waiting for workers to connect.
get_executor
¶
get_executor() -> DaskDistributedExecutor
Create an executor instance from the config.