[Train] Add ControllerError for the errors thrown from the controller#54633
[Train] Add ControllerError for the errors thrown from the controller#54633xinyuangui2 wants to merge 1 commit intoray-project:masterfrom
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @xinyuangui2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a more granular exception hierarchy for training failures within Ray Train's API. By refactoring the generic TrainingFailedError into a base class and creating distinct WorkerTrainingFailedError and SchedulingTrainingFailedError subclasses, it provides clearer distinction between different failure modes. This change is crucial for enabling more sophisticated error handling mechanisms, particularly for future FailurePolicy implementations that can specifically address scheduling-related exceptions during training.
Highlights
- Exception Hierarchy Refactoring: The existing
TrainingFailedErrorhas been refactored from a concrete exception into a base class for more specific training failure types. Its__init__method was simplified to only accept an error message. - New Worker-Specific Exception: A new exception,
WorkerTrainingFailedError, has been introduced. This class now specifically encapsulates training failures that originate from issues with individual workers, inheriting fromTrainingFailedErrorand retaining theworker_failuresattribute. - New Scheduling-Specific Exception: A new exception,
SchedulingTrainingFailedError, has been added. This class, also inheriting fromTrainingFailedError, is designed to specifically represent and handle training failures that occur due to underlying scheduling issues, including ascheduling_errorattribute. - Enabling Future Features: This refactoring is a foundational step to enable the implementation of a
FailurePolicythat can intelligently handle and respond to scheduling exceptions during the training process, as stated in the PR description.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request refactors TrainingFailedError into a base class with two specific subclasses, WorkerTrainingFailedError and SchedulingTrainingFailedError. There are potential serialization issues in the __init__ methods of the new exception classes that could cause issues with pickling and unpickling. I've left specific comments with suggestions on how to fix this.
Signed-off-by: xgui <xgui@anyscale.com>
20ab5de to
d46d39d
Compare
|
Moved to #54801 |
Why are these changes needed?
We are supporting to use FailurePolicy to handle the scheduling exception. And this requires we refactor the
TrainingFailedErrorfirstly.Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.