espnet3.parallel.parallel.get_client
Less than 1 minute
espnet3.parallel.parallel.get_client
espnet3.parallel.parallel.get_client(config: DictConfig = None, setup_fn: Callable[[], dict] | None = None) → Generator[Client, None, None]
Context manager to yield a Dask client from the global singleton cluster.
- Parameters:
- config (DictConfig , optional) – Cluster config.
- setup_fn (Callable [ [ ] , dict ] , optional) – A setup function that runs on each worker and returns a dictionary of environment variables.
- Yields:Client – A Dask client instance tied to the global cluster.
- Returns: Context manager yielding a client.
- Return type:Generator[Client, None, None]
Example
>>> with get_client() as client:
... results = client.map(lambda x: x**2, range(10))