MCPcopy
hub / github.com/pydata/xarray / get_write_lock

Function get_write_lock

xarray/backends/locks.py:175–189  ·  view source on GitHub ↗

Get a scheduler appropriate lock for writing to the given resource. Parameters ---------- key : str Name of the resource for which to acquire a lock. Typically a filename. Returns ------- Lock object that can be used like a threading.Lock object.

(key: str)

Source from the content-addressed store, hash-verified

173
174
175def get_write_lock(key: str) -> Lock:
176 """Get a scheduler appropriate lock for writing to the given resource.
177
178 Parameters
179 ----------
180 key : str
181 Name of the resource for which to acquire a lock. Typically a filename.
182
183 Returns
184 -------
185 Lock object that can be used like a threading.Lock object.
186 """
187 scheduler = get_dask_scheduler()
188 lock_maker = _get_lock_maker(scheduler)
189 return lock_maker(key)
190
191
192def acquire(lock, blocking=True):

Callers 3

openMethod · 0.90
openMethod · 0.90
__init__Method · 0.90

Calls 2

get_dask_schedulerFunction · 0.85
_get_lock_makerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…