Add `asynchronous: bool` flag to `get_client`
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 778
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 3
Description
Part of our API are various utility methods that are supposed to return the current, the default or a new client.
Top-level API is `worker.py::get_client` https://github.com/dask/distributed/blob/0a88b761be5887e9a72887c44e80f513cadf7020/distributed/worker.py#L2713-L2778
When this function is being used from an asynchronous context the returned client object is `asynchronous=False` by default and will basically be useless.
For this purpose, it would be helpful to add this as an argument to `get_client`
My proposal would be, in the case of a default or current client to raise a `RuntimeError` in case the default/current doesn't correspond to the appropriate asnychronous setting.
This relates to https://github.com/PrefectHQ/prefect/issues/12971
Contributor guide
Assessment
This issue has not been assessed yet.