-
Notifications
You must be signed in to change notification settings - Fork 154
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
feat: Enable custom predicates for media operations #1385
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.
Looking good, very excited about retry unification!
@@ -35,19 +39,34 @@ | |||
requests.ConnectionError, | |||
requests_exceptions.ChunkedEncodingError, | |||
requests_exceptions.Timeout, | |||
http.client.BadStatusLine, |
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.
LGTM, thanks for consolidating the retryable errors. Looking at the requests docs requests.ConnectionError
should be equivalent to requests.exceptions.ConnectionError
so we're good!
return _request_helpers.wait_and_retry( | ||
retriable_request, self._get_status_code, self._retry_strategy | ||
) | ||
return _request_helpers.wait_and_retry(retriable_request, self._retry_strategy) | ||
|
||
|
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.
nit: to match download, we probably want to add the retry arg docstrings for MultipartUpload, ResumableUpload etc
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.
Thanks, done
and the object will configure backoff and timeout options. Custom | ||
predicates (customizable error codes) are not supported for media | ||
operations such as this one. | ||
and the object will configure backoff and timeout options. |
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.
nit: Do we want to call out the default retry? I recall we received some feedback around stating the default value in our docstrings
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.
I would like to incorporate DEFAULT_RETRY into the docs somehow without copy/pasting it into every method. Not sure how to do that yet. I'd prefer not to include it in this change as it's already quite large but it's a good idea.
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.
Sounds good, let's update that in a separate PR
This refactor unifies the old resumable media retry code with the newer google.api_core retry code, enabling custom predicates for media operations.
Fixes #1361