Skip to content

Commit

Permalink
avoid DeprecationWarning in rpc.__exit__ by using rpc.__aexit__
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Mar 22, 2022
1 parent db4c627 commit 090f5ee
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions distributed/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,13 +739,16 @@ def cluster(
except KeyError:
rpc_kwargs = {}

with rpc(saddr, **rpc_kwargs) as s:
while True:
nthreads = loop.run_sync(s.ncores)
if len(nthreads) == nworkers:
break
if time() - start > 5:
raise Exception("Timeout on cluster creation")
async def wait_for_workers():
async with rpc(saddr, **rpc_kwargs) as s:
while True:
nthreads = await s.ncores()
if len(nthreads) == nworkers:
break
if time() - start > 5:
raise Exception("Timeout on cluster creation")

loop.run_sync(wait_for_workers)

# avoid sending processes down to function
yield {"address": saddr}, [
Expand Down

0 comments on commit 090f5ee

Please sign in to comment.