Skip to content

Log worker info on error - #7947

Closed
j-bennet wants to merge 9 commits into
dask:mainfrom
j-bennet:j-bennet/4880-cleanup-remote-tracebacks-2
Closed

j-bennet wants to merge 9 commits into
dask:mainfrom
j-bennet:j-bennet/4880-cleanup-remote-tracebacks-2

Conversation

@j-bennet

@j-bennet j-bennet commented Jun 23, 2023 •

Copy link
Copy Markdown
Contributor

Different version of #7847.

  • Tests added / passed
  • Passes pre-commit run --all-files

How this works:

import distributed

class BadNumbers(Exception):
    def __str__(self):
        return "I didn't like these numbers: " + " ".join(f"{x:.1f}" for x in self.args)

def f():
    raise BadNumbers(1, 2.5, 3)

client = distributed.Client()
client.submit(f).result()

2023-07-20 15:02:50,741 - distributed.worker - WARNING - Compute Failed
Key:       f-b49acabd688e43ee290e83e090a617ea
Function:  f
args:      ()
kwargs:    {}
Exception: 'BadNumbers(1, 2.5, 3)'

2023-07-20 15:02:50,743 - distributed.client - ERROR - Compute Failed
Key:       f-b49acabd688e43ee290e83e090a617ea
Function:  f
args:      ()
kwargs:    {}
Exception: BadNumbers(1, 2.5, 3)
Worker:    {'tcp://127.0.0.1:63910'}
---------------------------------------------------------------------------
BadNumbers                                Traceback (most recent call last)
Cell In[3], line 1
----> 1 client.submit(f).result()

Cell In[2], line 8, in f()
      7 def f():
----> 8     raise BadNumbers(1, 2.5, 3)

BadNumbers: I didn't like these numbers: 1.0 2.5 3.0

@j-bennet
j-bennet requested a review from fjetter as a code owner June 23, 2023 22:40
@j-bennet
j-bennet marked this pull request as draft June 23, 2023 22:40
@j-bennet j-bennet mentioned this pull request Jun 23, 2023
2 tasks done
@github-actions

github-actions Bot commented Jun 24, 2023 •

Copy link
Copy Markdown
Contributor

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

       20 files  ±0         20 suites  ±0   11h 23m 50s ⏱️ - 41m 13s
  3 754 tests ±0    3 638 ✔️  -   5     106 💤 ±0  10 ❌ +  6 
36 314 runs  ±0  34 521 ✔️  - 36  1 746 💤  - 2  47 ❌ +39 

For more details on these failures, see this check.

Results for commit 23ce7b3. ± Comparison against base commit 4c4748a.

♻️ This comment has been updated with latest results.

@j-bennet
j-bennet requested a review from crusaderky June 24, 2023 00:35
Comment thread distributed/client.py Resolved
@crusaderky

Copy link
Copy Markdown
Collaborator

Instead of:

2023-06-23 15:37:47,237 - distributed.worker - WARNING - Compute Failed
Key:       f-78eea523b6ed747be234c3bfbc24c116
Function:  f
args:      ()
kwargs:    {}
Exception: 'BadNumbers(1, 2.5, 3)'

2023-06-23 15:37:47,238 - distributed.client - ERROR - in task: f-78eea523b6ed747be234c3bfbc24c116
on worker:{'tcp://127.0.0.1:54346'}

Wouldn't it be much cleaner and simpler to just add a line to the already existing message?

2023-06-23 15:37:47,237 - distributed.worker - WARNING - Compute Failed
Key:       f-78eea523b6ed747be234c3bfbc24c116
Function:  f
args:      ()
kwargs:    {}
Exception: 'BadNumbers(1, 2.5, 3)'
Worker:    tcp://127.0.0.1:54346

@j-bennet

j-bennet commented Jul 7, 2023

Copy link
Copy Markdown
Contributor Author

@crusaderky

Wouldn't it be much cleaner and simpler to just add a line to the already existing message?

It's not so easy, unfortunately. I wish every Python exception had something like a read-write message property that you could easily modify, and we would not need to jump through all these hoops, but that's not the case.

This PR is based on your suggestion here:

#7847 (comment)

@j-bennet
j-bennet marked this pull request as ready for review July 20, 2023 22:03
@j-bennet
j-bennet requested a review from crusaderky July 20, 2023 22:03
@j-bennet

Copy link
Copy Markdown
Contributor Author

@crusaderky I made changes as we discussed. The message emitted on client is now very similar to the one emitted on worker.

@j-bennet
j-bennet force-pushed the j-bennet/4880-cleanup-remote-tracebacks-2 branch from ae00614 to b71375d Compare July 20, 2023 22:43
Comment thread distributed/client.py Resolved
Comment thread distributed/client.py Resolved
Comment thread distributed/client.py Resolved
Comment thread distributed/client.py Resolved
Comment thread distributed/queues.py Resolved
Comment thread distributed/tests/test_client.py Resolved
Comment thread distributed/variable.py Resolved

@crusaderky crusaderky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@j-bennet
j-bennet requested a review from crusaderky August 1, 2023 18:01
@j-bennet j-bennet closed this Aug 29, 2023
@j-bennet
j-bennet deleted the j-bennet/4880-cleanup-remote-tracebacks-2 branch August 29, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants