-
Notifications
You must be signed in to change notification settings - Fork 14
Fix/error code hints 215 #243
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
Open
XXOriginalXX
wants to merge
5
commits into
mlcommons:dev
Choose a base branch
from
XXOriginalXX:fix/error-code-hints-215
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
90d5ff9
fix(script_action) added human readable hints for script exit codes (…
XXOriginalXX 63e1cef
fix(script_action) added human readable hints for script exit codes (…
XXOriginalXX 3c65257
fix(script_action) added human readable hints for script exit codes (…
XXOriginalXX ec5955f
fix(script_action) added human readable hints for script exit codes (…
XXOriginalXX bd702aa
style: apply autopep8 formatting to script_action.py
XXOriginalXX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Test error code hints | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["*"] | ||
| pull_request: | ||
| branches: [dev, main] | ||
|
|
||
| jobs: | ||
| test-error-code-hints: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.10" | ||
|
|
||
| - name: Install mlcflow | ||
| run: pip install -e . | ||
|
|
||
| - name: Test exit code hint helper | ||
| run: | | ||
| python -c " | ||
| from mlc.script_action import _get_exit_code_hint, ScriptExecutionError | ||
|
|
||
| # Known codes return specific hints | ||
| assert 'Segmentation fault' in _get_exit_code_hint(139) | ||
| assert 'disk space' in _get_exit_code_hint(28).lower() | ||
| assert 'Network error' in _get_exit_code_hint(6) | ||
| assert 'Network error' in _get_exit_code_hint(7) | ||
| assert 'PATH' in _get_exit_code_hint(127) | ||
|
|
||
| # Unknown code returns generic fallback with the code number | ||
| hint = _get_exit_code_hint(999) | ||
| assert '999' in hint | ||
|
|
||
| # ScriptExecutionError embeds hint in message | ||
| err = ScriptExecutionError('test failed', return_code=139) | ||
| assert 'Segmentation fault' in str(err) | ||
| assert err.return_code == 139 | ||
|
|
||
| # return_code=-1 means no hint appended | ||
| err2 = ScriptExecutionError('test failed') | ||
| assert str(err2) == 'test failed' | ||
|
|
||
| print('All assertions passed.') | ||
| " |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,5 @@ build | |
| dist | ||
| *egg-info | ||
| __pycache__ | ||
|
|
||
| .vscode | ||
| .mlc-log.txt | ||
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
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
Oops, something went wrong.
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.
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.
Looks good. Thank you for the contribution!
Can you please remove any formatting for the existing code? - there's an autoformatter running in github action which will otherwise reformat the code again.
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.
Done applied autopep8 formatting to script_action.py.