MCPcopy
hub / github.com/dask/dask / local_callbacks

Function local_callbacks

dask/callbacks.py:95–107  ·  view source on GitHub ↗

Allows callbacks to work with nested schedulers. Callbacks will only be used by the first started scheduler they encounter. This means that only the outermost scheduler will use global callbacks.

(callbacks=None)

Source from the content-addressed store, hash-verified

93
94@contextmanager
95def local_callbacks(callbacks=None):
96 """Allows callbacks to work with nested schedulers.
97
98 Callbacks will only be used by the first started scheduler they encounter.
99 This means that only the outermost scheduler will use global callbacks."""
100 global_callbacks = callbacks is None
101 if global_callbacks:
102 callbacks, Callback.active = Callback.active, set()
103 try:
104 yield callbacks or ()
105 finally:
106 if global_callbacks:
107 Callback.active = callbacks
108
109
110def normalize_callback(cb):

Callers 1

get_asyncFunction · 0.90

Calls 1

setClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…