Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log original exception upon compute failure #5387

Merged
merged 1 commit into from
Oct 4, 2021
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
25 changes: 7 additions & 18 deletions distributed/tests/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,28 +739,17 @@ async def test_dont_overlap_communications_to_same_worker(c, s, a, b):
assert l1["stop"] < l2["start"]


@pytest.mark.avoid_ci
@gen_cluster(client=True)
async def test_log_exception_on_failed_task(c, s, a, b):
with tmpfile() as fn:
fh = logging.FileHandler(fn)
try:
from distributed.worker import logger

logger.addHandler(fh)
with captured_logger("distributed.worker") as logger:
future = c.submit(div, 1, 0)
await wait(future)

future = c.submit(div, 1, 0)
await wait(future)

await asyncio.sleep(0.1)
fh.flush()
with open(fn) as f:
text = f.read()
await asyncio.sleep(0.1)

assert "ZeroDivisionError" in text
assert "Exception" in text
finally:
logger.removeHandler(fh)
text = logger.getvalue()
assert "ZeroDivisionError" in text
assert "Exception" in text


@gen_cluster(client=True)
Expand Down
2 changes: 1 addition & 1 deletion distributed/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3088,7 +3088,7 @@ async def execute(self, key, *, stimulus_id):
str(funcname(function))[:1000],
convert_args_to_str(args2, max_len=1000),
convert_kwargs_to_str(kwargs2, max_len=1000),
ts.exception_text,
result["exception_text"],
)
recommendations[ts] = (
"error",
Expand Down