MCPcopy Index your code
hub / github.com/pydata/xarray / _get_lock_maker

Function _get_lock_maker

xarray/backends/locks.py:110–134  ·  view source on GitHub ↗

Returns an appropriate function for creating resource locks. Parameters ---------- scheduler : str or None Dask scheduler being used. See Also -------- dask.utils.get_scheduler_lock

(scheduler: str | None = None)

Source from the content-addressed store, hash-verified

108
109
110def _get_lock_maker(scheduler: str | None = None) -> Callable[..., Lock]:
111 """Returns an appropriate function for creating resource locks.
112
113 Parameters
114 ----------
115 scheduler : str or None
116 Dask scheduler being used.
117
118 See Also
119 --------
120 dask.utils.get_scheduler_lock
121 """
122
123 if scheduler is None or scheduler == "threaded":
124 return _get_threaded_lock
125 elif scheduler == "multiprocessing":
126 return _get_multiprocessing_lock
127 elif scheduler == "distributed":
128 # Lazy import distributed since it is can add a significant
129 # amount of time to import
130 from dask.distributed import Lock as DistributedLock
131
132 return DistributedLock
133 else:
134 raise KeyError(scheduler)
135
136
137def get_dask_scheduler(get=None, collection=None) -> str | None:

Callers 1

get_write_lockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…