[train] add trace to WorkerHealthCheckFailedError#53626
Merged
matthewdeng merged 1 commit intoray-project:masterfrom Jun 11, 2025
Merged
[train] add trace to WorkerHealthCheckFailedError#53626matthewdeng merged 1 commit intoray-project:masterfrom
matthewdeng merged 1 commit intoray-project:masterfrom
Conversation
Signed-off-by: Matthew Deng <matt@anyscale.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the WorkerHealthCheckFailedError exception by appending the underlying health check failure reason to its string output.
- Overrides
__str__to include the base exception message. - Ensures end users see the root cause when a worker health check fails.
Comments suppressed due to low confidence (2)
python/ray/train/v2/_internal/exceptions.py:44
- Add unit tests for the new
__str__method to verify that the underlyinghealth_check_failureis correctly included in the returned string.
def __str__(self):
python/ray/train/v2/_internal/exceptions.py:44
- Consider using Python exception chaining (e.g.,
raise WorkerHealthCheckFailedError(...) from health_check_failure) instead of manual string concatenation so the original traceback is preserved and printed automatically.
def __str__(self):
justinvyu
reviewed
Jun 9, 2025
Comment on lines
+44
to
+45
| def __str__(self): | ||
| return self._message + "\n" + str(self.health_check_failure) |
Contributor
There was a problem hiding this comment.
thoughts on setting the __cause__ of the this error to be the worker error, then not needing to update the string representation?
Contributor
Author
There was a problem hiding this comment.
Just tested this, unfortunately __cause__ doesn't get included in the string-representation, only when the traceback is printed (e.g. when the exception is raised).
justinvyu
approved these changes
Jun 11, 2025
elliot-barn
pushed a commit
that referenced
this pull request
Jun 18, 2025
Improve the string representation of `WorkerHealthCheckFailedError` to also include the base reason why the health check failed. Signed-off-by: Matthew Deng <matt@anyscale.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn
pushed a commit
that referenced
this pull request
Jul 2, 2025
Improve the string representation of `WorkerHealthCheckFailedError` to also include the base reason why the health check failed. Signed-off-by: Matthew Deng <matt@anyscale.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve the string representation of
WorkerHealthCheckFailedErrorto also include the base reason why the health check failed.Repro
Before
After