refactor: improve error handling with custom exceptions#414
Open
abeiabeiqq wants to merge 1 commit intoalibaba:mainfrom
Open
refactor: improve error handling with custom exceptions#414abeiabeiqq wants to merge 1 commit intoalibaba:mainfrom
abeiabeiqq wants to merge 1 commit intoalibaba:mainfrom
Conversation
a3e89fe to
cdb5947
Compare
- Replace assert statements with custom RollError exceptions - Add RollConfigValidationError, RollConfigConflictError for config errors - Add RollDistributedError for distributed system errors - Add RollModelError for model-related errors - Add RollDataError for data-related errors - Improve error messages with context and suggestions - Total 63 assert statements improved across 14 files Modified files: - roll/configs/base_config.py, worker_config.py, data_args.py - roll/pipeline/rlvr/rlvr_pipeline.py, rlvr_config.py - roll/pipeline/dpo/dpo_pipeline.py, dpo_config.py - roll/pipeline/agentic/agentic_pipeline.py, agentic_config.py - roll/distributed/strategy/strategy.py, vllm_strategy.py, sglang_strategy.py - roll/distributed/executor/cluster.py, model_update_group.py - roll/utils/exceptions.py (new file)
cdb5947 to
dcd82f8
Compare
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.
Summary
This PR improves error handling across the ROLL codebase by replacing
assertstatements with custom exception classes, providing better error messages with context and suggestions for debugging.Changes
New Exception System (
roll/utils/exceptions.py)A comprehensive exception hierarchy with error codes:
RollConfigValidationErrorRollConfigConflictErrorRollDistributedErrorRollModelErrorRollDataErrorRollPipelineErrorRollEnvironmentErrorModified Files
roll/configs/base_config.pyroll/utils/exceptions.pyExample
Before:
After:
Benefits
to_dict()method for structured log integrationTesting
Future Work
This PR establishes the exception framework. Additional modules can be improved incrementally:
roll/pipeline/rlvr/- 8 remaining assertsroll/pipeline/dpo/- 4 remaining assertsroll/pipeline/agentic/- 18 remaining assertsroll/distributed/strategy/- 15 remaining assertsroll/distributed/executor/- 11 remaining asserts