-
Notifications
You must be signed in to change notification settings - Fork 350
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
fix: Add retries when polling during monitoring runs #786
Conversation
@@ -532,7 +536,9 @@ def _get_gca_resource(self, resource_name: str) -> proto.Message: | |||
location=self.location, | |||
) | |||
|
|||
return getattr(self.api_client, self._getter_method)(name=resource_name) | |||
return getattr(self.api_client, self._getter_method)( |
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.
How about delete
and list
methods?
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.
The purpose of the PR is to address intermittent failure during polling and the goal is to scope to that issue.
We can follow up on list
and delete
. delete
will take additional care as the request to delete may get through to the service but we may not receive a response and retrying delete
will throw an exception.
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'm wondering if this would actually change anything as there is already a default retry associated with the client methods.
For example, EndpointServiceAsyncClient
has:
async def get_endpoint(
self,
request: endpoint_service.GetEndpointRequest = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> endpoint.Endpoint:
Is the default retry not sufficient?
@@ -48,6 +49,9 @@ | |||
|
|||
logging.basicConfig(level=logging.INFO, stream=sys.stdout) | |||
|
|||
# This is the default retry callback to be used with get methods. | |||
_DEFAULT_RETRY = retry.Retry() |
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.
IIUC gapic_v1.method.DEFAULT is used when no retry is provided (https://github.com/googleapis/python-aiplatform/search?q=retry%3D). I wonder if there is any difference between _DEFAULT_RETRY and gapic_v1.method.DEFAULT?
If there is no difference, I think we need a more aggressive _DEFAULT_RETRY to fix the current problem.
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.
gapic_v1.method.DEFAULT
is a sentinel value that is used to set the default retry passed into the constructor of the Gapic callable.
See usage here: https://github.com/googleapis/python-api-core/blob/main/google/api_core/gapic_v1/method.py#L125
The default retry is None
: https://github.com/googleapis/python-api-core/blob/main/google/api_core/gapic_v1/method.py#L147
cc: @ivanmkc
LGTM, thanks Sasha! |
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
b/200047992