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.
Example
>>> with get_client() as client:
... results = client.map(lambda x: x**2, range(10))