Skip to content

Commit

Permalink
verify logging output
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed May 26, 2022
1 parent 440219f commit 3860122
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions distributed/tests/test_preload.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import os
import re
import shutil
Expand Down Expand Up @@ -281,6 +282,23 @@ def dask_setup(client, value):
assert c.foo == value


@gen_test()
async def test_teardown_failure_doesnt_crash_scheduler():
text = """
def dask_teardown(worker):
raise Exception(123)
"""

with captured_logger(logging.getLogger("distributed.scheduler")) as s_logger:
with captured_logger(logging.getLogger("distributed.worker")) as w_logger:
async with Scheduler(dashboard_address=":0", preload=text) as s:
async with Worker(s.address, preload=[text]) as w:
pass

assert "123" in s_logger.getvalue()
assert "123" in w_logger.getvalue()


@gen_cluster(nthreads=[])
async def test_client_preload_config_click(s):
text = dedent(
Expand All @@ -302,14 +320,3 @@ def dask_setup(client, value):
):
async with Client(address=s.address, asynchronous=True) as c:
assert c.foo == value


@gen_test()
async def test_teardown_failure_doesnt_crash_scheduler():
text = """
def dask_teardown(worker):
raise Exception(123)
"""
async with Scheduler(dashboard_address=":0", preload=text) as s:
async with Worker(s.address, preload=[text]) as w:
pass

0 comments on commit 3860122

Please sign in to comment.