Open fjetter opened 1 year ago
Thanks again for opening this issue @fjetter! Any idea on when someone might have bandwidth to work on this?
When this function is being used from an asynchronous context
In my experience, it's not just that, but also this function doesn't work at all from an async task.
So unless I'm doing something silly, making it work is also part of the work here.
I got hit by this today, would be nice to merge the fix
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-L2778When 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 toget_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