-
Notifications
You must be signed in to change notification settings - Fork 840
[S3] More comprehensive error handling #2451
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: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enhances S3 error handling by introducing a dedicated 400 “invalid request” code and refactoring the client‐error normalization to use categorized error sets.
- Added
ERROR_INVALID_REQUEST
constant and mapped it inop_info
,handle_client_error
,get_info
, andlist_prefix
. - Refactored
normalize_client_error
to classify errors into permission, not found, range, transient, and fatal groups. - Updated higher‐level S3 operations to raise or propagate the new 400 error.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
metaflow/plugins/datatools/s3/s3op.py | Added ERROR_INVALID_REQUEST , categorized error sets, and 400 mappings |
metaflow/plugins/datatools/s3/s3.py | Raised new 400 error in _head and _one_boto_op |
Comments suppressed due to low confidence (2)
metaflow/plugins/datatools/s3/s3op.py:261
- [nitpick] There are no unit tests verifying the new 400 (
ERROR_INVALID_REQUEST
) branch inop_info
. Consider adding tests to cover this error mapping to avoid regressions.
elif error_code == 400:
metaflow/plugins/datatools/s3/s3.py:856
- [nitpick] Raising the generic
MetaflowS3Exception
for invalid requests may obscure this specific scenario. Consider defining a distinct exception class (e.g.,MetaflowS3InvalidRequest
) for clearer error handling.
elif info["error"] == s3op.ERROR_INVALID_REQUEST:
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.
Minor nits but lgtm.
return 503 | ||
pass | ||
|
||
# Permission or access-related errors → 403 Forbidden |
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.
If you got these errors from a specific location (doc), could you add a link to it so we can periodically check if they haven't changed. This is much cleaner though so hopefully it will help going forward.
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.
added links and some more error codes
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.
ok i think i got them all now
@npow adding the label to run S3 tests against |
ExpiredToken
are no longer retried.