Skip to content

Commit

Permalink
merging sus workers test into test_bad_tasks_fail
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rakowski committed May 10, 2024
1 parent 643b5b3 commit 2a8b8ba
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3595,32 +3595,14 @@ async def test_bad_tasks_fail(c, s, a, b):
text = logger.getvalue()
assert f.key in text

assert info.value.last_worker.nanny in {a.address, b.address}
await asyncio.gather(a.close(), b.close())


@gen_cluster(
client=True,
Worker=Nanny,
clean_kwargs={"threads": False, "processes": False},
)
async def test_suspicious_workers(c, s, a, b):
"""
c: Client
s: Scheduler
a: Worker # name: 0
b: Worker # name: 1
"""
f = c.submit(sys.exit, 0) # f: Future
with captured_logger("distributed.scheduler") as logger:
with pytest.raises(KilledWorker) as info:
await f

events = await c.get_events()
# get the last event from the list of suspicious tasks
time_stamp, msg = events["suspicious-tasks"][-1]

time_stamp, msg = events["suspicious-tasks"][-1] # get last worker failure event
assert msg["count"] == s.allowed_failures + 1

assert info.value.last_worker.nanny in {a.address, b.address}
await asyncio.gather(a.close(), b.close())


def test_get_processing_sync(c, s, a, b):
processing = c.processing()
Expand Down

0 comments on commit 2a8b8ba

Please sign in to comment.