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]
Yield a Dask client configured for shard-based runner execution.
- 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.
Notes
setup_fnis executed once per worker and should return a dict.- Callers should prefer
BaseRunnerinstead of interacting with the client directly for ESPnet3 workflows.
Example
>>> from omegaconf import OmegaConf
>>> cfg = OmegaConf.create({"env": "local", "n_workers": 2, "options": {}})
>>> set_parallel(cfg)
>>> with get_client() as client:
... future = client.submit(lambda: 42)
... result = future.result()