-
-
Notifications
You must be signed in to change notification settings - Fork 734
Expose details in worker timeout exceptions #9092
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
base: main
Are you sure you want to change the base?
Conversation
so that calling code can have more precise logic about how to handle the error
c3ee5de
to
097ed4a
Compare
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 27 files ±0 27 suites ±0 11h 14m 31s ⏱️ + 6m 51s For more details on these failures and errors, see this check. Results for commit 097ed4a. ± Comparison against base commit 9c8cd91. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this seems useful thanks!
@property | ||
def available_workers(self) -> int: | ||
"""Number of workers that are available.""" | ||
return self.args[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not seen exceptions implemented this way before with properties pointing to arg indices. There's a code smell here I can't quite put my finger on, it feels brittle.
Why not set the attributes explicitly during the __init__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hah, I totally agree! I had originally set the attributes in __init__
but noticed that other custom exceptions in this project were following this (odd) pattern so just went with it for consistency. Happy to revert back to my original approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One example of the existing pattern:
distributed/distributed/scheduler.py
Line 9302 in 9c8cd91
class KilledWorker(Exception): |
in a structured way so that calling code can have more precise logic about how to handle the error
Closes #xxxx
added/ passedpre-commit run --all-files