-
Notifications
You must be signed in to change notification settings - Fork 69
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: wrap async rest methods with retry and error logic #2139
feat: wrap async rest methods with retry and error logic #2139
Conversation
NOTE: The base branch of this PR should be updated to |
9b98c48
to
8475e46
Compare
8475e46
to
5fd24b6
Compare
5fd24b6
to
4c5a9c6
Compare
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 non-blocking comment. Feel free to follow up in a later PR
[cloud_redis.CreateInstanceRequest], | ||
operations_pb2.Operation]: | ||
|
||
return # type: ignore |
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.
Please add a comment to clarify the reason that we have # type: ignore
here and add TODO bug to follow up on it
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.
+1
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.
addressed.
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.
Not seeing it...
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 comment's added in the jinja template and not the generated file:
https://github.com/googleapis/gapic-generator-python/pull/2139/files#diff-95a8ad0682619d6c91209ed703a5d69b195ea28be2711b516d956265695acc14R96
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.
Also a related thread from the PR above it: #2140 (comment).
79cc77d
to
23cb93e
Compare
...egration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest_asyncio.py
Show resolved
Hide resolved
[cloud_redis.CreateInstanceRequest], | ||
operations_pb2.Operation]: | ||
|
||
return # type: ignore |
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.
+1
def create_instance(self) -> Callable[ | ||
[cloud_redis.CreateInstanceRequest], | ||
operations_pb2.Operation]: | ||
|
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: remove this empty blank line for now
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.
addressed.
""" Precompute the wrapped methods, overriding the base class method to use async wrappers.""" | ||
self._wrapped_methods = { | ||
self.list_instances: self._wrap_method( | ||
self.list_instances, |
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: It would be good if we could test a method with retry settings, since those are used in prep_wrapped_messages_async_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.
Good point! I think it won't be that straightforward to test retry logic before the actual call methods are implemented (for async rest) . I also think that we should add similar tests for async gRPC.
Filed: #2155
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.
Retry logic will be tested as part of e2e showcase testing (once we turn them on for async REST) which is something that I just remembered.
[cloud_redis.CreateInstanceRequest], | ||
operations_pb2.Operation]: | ||
|
||
return # type: ignore |
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.
Not seeing it...
This PR adds error handling and retry logic to async rest methods. Note that the
callables
will be implemented in a follow up PR.This PR should be reviewed and merged after: #2138.