diff --git a/distributed/tests/test_worker.py b/distributed/tests/test_worker.py index 117ad00406..fa78641828 100644 --- a/distributed/tests/test_worker.py +++ b/distributed/tests/test_worker.py @@ -878,6 +878,7 @@ async def test_log_exception_on_failed_task(c, s, a, b): text = logger.getvalue() assert "ZeroDivisionError" in text assert "Exception" in text + assert "Traceback" in text @gen_cluster(client=True) diff --git a/distributed/worker.py b/distributed/worker.py index 27be73e30a..17d715507e 100644 --- a/distributed/worker.py +++ b/distributed/worker.py @@ -2348,13 +2348,15 @@ async def execute(self, key: Key, *, stimulus_id: str) -> StateMachineEvent: "Function: %s\n" "args: %s\n" "kwargs: %s\n" - "Exception: %r\n", + "Exception: %r\n" + "Traceback: %r\n", key, ts.state, str(funcname(function))[:1000], convert_args_to_str(args2, max_len=1000), convert_kwargs_to_str(kwargs2, max_len=1000), result["exception_text"], + result["traceback_text"], ) return ExecuteFailureEvent.from_exception(