MCPcopy Create free account
hub / github.com/dask/dask / _ensure_not_async

Function _ensure_not_async

dask/base.py:1093–1110  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

1091
1092
1093def _ensure_not_async(client):
1094 if client.asynchronous:
1095 if fallback := config.get("admin.async-client-fallback", None):
1096 warnings.warn(
1097 "Distributed Client detected but Client instance is "
1098 f"asynchronous. Falling back to `{fallback}` scheduler. "
1099 "To use an asynchronous Client, please use "
1100 "``Client.compute`` and ``Client.gather`` "
1101 "instead of the top level ``dask.compute``",
1102 UserWarning,
1103 )
1104 return get_scheduler(scheduler=fallback)
1105 else:
1106 raise RuntimeError(
1107 "Attempting to use an asynchronous "
1108 "Client in a synchronous context of `dask.compute`"
1109 )
1110 return client.get
1111
1112
1113def get_scheduler(get=None, scheduler=None, collections=None, cls=None):

Callers 1

get_schedulerFunction · 0.85

Calls 2

get_schedulerFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected