Repository navigation
Conversation
|
Can one of the admins verify this patch? Admins can comment |
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 20 files ±0 20 suites ±0 10h 55m 52s ⏱️ - 27m 41s For more details on these failures, see this check. Results for commit b8478c1. ± Comparison against base commit e0dbb35. ♻️ This comment has been updated with latest results. |
You shouldn't consider what's in this ticket as a request but rather as a suggestion. If we don't have this information easily available, this should not drive implementation effort |
Your response in Slack was helpful with this part. I'd rather not override the built-in formatting method to print a custom header on top of an exception, and I don't want to wrap it with a custom Exception, or attach a made-up context, so the easiest thing to do was tucking it into exception See what you think. |
bdb2e3d to
10ec8e3
Compare
|
@crusaderky This PR was reworked, and now the only thing it does is pushing worker info into remote exception. Actual traceback cleanup is done in dask/dask#10354. Please take a look. It seems to me that test failures are not related. |
44d2f1f to
84464b9
Compare
crusaderky
left a comment
There was a problem hiding this comment.
Please add unit tests
| exception.args = (worker_message,) | ||
| else: | ||
| arg0 = f"{exception.args[0]}\n{worker_message}" | ||
| exception.args = (arg0,) + exception.args[1:] |
There was a problem hiding this comment.
What kind of exception is this? is this a specific exception type raised by distributed?
args can contain very different things depending on the exception subclass and this change will break many custom exceptions.
There was a problem hiding this comment.
This comment has not been addressed.
In fact, I can very easily make it break:
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)
f()
---------------------------------------------------------------------------
BadNumbers Traceback (most recent call last)
Cell In[10], line 8
5 def f():
6 raise BadNumbers(1, 2.5, 3)
----> 8 f()
Cell In[10], line 6, in f()
5 def f():
----> 6 raise BadNumbers(1, 2.5, 3)
BadNumbers: I didn't like these numbers: 1.0 2.5 3.0
import distributed
client = distributed.Client()
client.submit(f).result()
Custom TB Handler failed, unregistering
---------------------------------------------------------------------------
BadNumbers Traceback (most recent call last)
[... skipping hidden 1 frame]
Cell In[12], line 1
----> 1 c.submit(f).result()
Cell In[10], line 6, in f()
5 def f():
----> 6 raise BadNumbers(1, 2.5, 3)
<class 'str'>: (<class 'ValueError'>, ValueError("Unknown format code 'f' for object of type 'str'"))
[...]
TypeError: structured_traceback() missing 1 required positional argument: 'evalue'There was a problem hiding this comment.
Ah. I addressed this comment here:
But I changed the implementation since, so it's not relevant anymore.
Co-authored-by: crusaderky <[email protected]>
Co-authored-by: crusaderky <[email protected]>
|
As it is right now, I do not think this PR is a good idea, at all. |
That's a nice breaking example. I think we have a couple of options here, they each have their drawback. One, like you said, could be |
|
Re-raising a wrapper exception would make the traceback less readable and break backwards compatibility.
I don't follow. You'd just call logger.error from Future.result() or whatever re-raises the exception. |
I agree. I tried another way, and it might actually solve that problem. It solves the problem with |
08a82c3 to
e79bda2
Compare
I created another PR here to illustrate this approach: It's a valid approach, less hacky than the current PR, but user still needs to scroll up for worker info. This is what I meant when I said "but that still means any unhandled exception would not have worker info". The client logs worker info, but the exception thrown on the client doesn't have it: ---------------------------------------------------------------------------
BadNumbers Traceback (most recent call last)
Cell In[5], line 1
----> 1 client.submit(f).result()
Cell In[3], line 2, in f()
1 def f():
----> 2 raise BadNumbers(1, 2.5, 3)
BadNumbers: I didn't like these numbers: 1.0 2.5 3.0Maybe this is fine. I can go with #7947 too. |
|
Closing in favor of #7947. |
Part of #4880.
Depends on dask/dask#10354.
Adds information about worker and task to exception
str(). When the exception is printed by excepthook, it looks like this:Example:
pre-commit run --all-files