(c, s, a, b)
| 318 | |
| 319 | @gen_cluster(client=True) |
| 320 | async def test_serializable_locks(c, s, a, b) -> None: |
| 321 | def f(x, lock=None): |
| 322 | with lock: |
| 323 | return x + 1 |
| 324 | |
| 325 | # note, the creation of Lock needs to be done inside a cluster |
| 326 | for lock in [ |
| 327 | HDF5_LOCK, |
| 328 | Lock(), |
| 329 | Lock("filename.nc"), |
| 330 | CombinedLock([HDF5_LOCK]), |
| 331 | CombinedLock([HDF5_LOCK, Lock("filename.nc")]), |
| 332 | ]: |
| 333 | futures = c.map(f, list(range(10)), lock=lock) |
| 334 | await c.gather(futures) |
| 335 | |
| 336 | lock2 = pickle.loads(pickle.dumps(lock)) |
| 337 | assert type(lock) is type(lock2) |
nothing calls this directly
no test coverage detected
searching dependent graphs…