Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
_UnhashableCallable,
async_wait_for,
asyncinc,
block_on_event,
captured_logger,
cluster,
dec,
Expand Down Expand Up @@ -727,8 +728,9 @@ async def test_wait(c, s, a, b):

@gen_cluster(client=True)
async def test_wait_first_completed(c, s, a, b):
x = c.submit(slowinc, 1)
y = c.submit(slowinc, 1)
event = Event()
x = c.submit(block_on_event, event)
y = c.submit(block_on_event, event)
z = c.submit(inc, 2)

done, not_done = await wait([x, y, z], return_when="FIRST_COMPLETED")
Expand All @@ -738,6 +740,7 @@ async def test_wait_first_completed(c, s, a, b):
assert z.status == "finished"
assert x.status == "pending"
assert y.status == "pending"
await event.set()


@gen_cluster(client=True)
Expand Down
6 changes: 5 additions & 1 deletion distributed/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

import dask

from distributed import Scheduler, system
from distributed import Event, Scheduler, system
from distributed import versions as version_module
from distributed.batched import BatchedSend
from distributed.client import Client, _global_clients, default_client
Expand Down Expand Up @@ -289,6 +289,10 @@ def lock_inc(x, lock):
return x + 1


def block_on_event(event: Event) -> None:
event.wait()


class _UnhashableCallable:
# FIXME https://github.com/python/mypy/issues/4266
__hash__ = None # type: ignore
Expand Down