-
Notifications
You must be signed in to change notification settings - Fork 88
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: implement OperationsRestAsyncTransport
to support long running operations
#700
feat: implement OperationsRestAsyncTransport
to support long running operations
#700
Conversation
21bdadd
to
1e108b4
Compare
0ee82e0
to
6e51532
Compare
b6c1c6c
to
eb78445
Compare
OperationsRestAsyncTransport
to support long running operations
bf76338
to
f880c72
Compare
from google.auth.aio import credentials as ga_credentials_async | ||
|
||
try: | ||
import aiohttp |
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.
Do we use aiohttp
in this file? A search reveals no references
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.
We don't. We're only importing it to check that the library is installed with the async_rest
extra.
Now, the actual problem is that if the libraries within the try block aren't installed, we silently skip the tests for async. Happy to discuss that.
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.
So we try importing aiohttp
and transport
because (1) we'll need them elsewhere for async REST, and (2) we want to set the flag GOOGLE_AUTH_AIO_INSTALLED
. We only look at the flag in this file to do the right thing.
I agree with doing the right thing. What makes me uneasy is the mysterious coupling with other modules "elsewhere" in (1). I think it would be more elegant to have a package-wide function or constant that takes care of querying the right things for async REST, probably by delegating to the files that use these imports.
However, this is a test file, so no need to block on this. But we should follow up.
self, | ||
request: operations_pb2.ListOperationsRequest, | ||
*, | ||
timeout: Optional[float] = None, |
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.
Why don't we have retry
as in the sync case?
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
isn't passed down to the auth layer i.e. it's unused. We should file an issue to fix that for the case of sync and add this as a follow up feature to the async transport class.
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.
Could you file an issue to do those things?
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.
Filed issues for each.
from google.auth.aio import credentials as ga_credentials_async | ||
|
||
try: | ||
import aiohttp |
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.
So we try importing aiohttp
and transport
because (1) we'll need them elsewhere for async REST, and (2) we want to set the flag GOOGLE_AUTH_AIO_INSTALLED
. We only look at the flag in this file to do the right thing.
I agree with doing the right thing. What makes me uneasy is the mysterious coupling with other modules "elsewhere" in (1). I think it would be more elegant to have a package-wide function or constant that takes care of querying the right things for async REST, probably by delegating to the files that use these imports.
However, this is a test file, so no need to block on this. But we should follow up.
self, | ||
request: operations_pb2.ListOperationsRequest, | ||
*, | ||
timeout: Optional[float] = None, |
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.
Could you file an issue to do those things?
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( | ||
gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, | ||
grpc_version=None, | ||
rest_version=auth_version, |
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 also just filed #719 to rationalize this further, separately.
* feat: implement `OperationsRestAsyncTransport` to support long running operations (#700) * feat: Add OperationsRestAsyncTransport to support long running operations * update TODO comment * update TODO comment * address feedback * address feedback * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix mypy and lint issues * minor fix * add no cover * fix no cover tag * link coverage issue * silence coverage issue * fix statement name error * address PR feedback * address PR feedback * address PR comments --------- Co-authored-by: ohmayr <omairnaveed@ymail.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * feat: implement async client for LROs (#707) * feat: implement `AbstractOperationsAsyncClient` to support long running operations * remove coverage guards * address presubmit failures * fix coverage for cancel operation * tests cleanup * fix incorrect tests * file bugs * add auth import * address PR comments * address PR comments * fix unit tests and address more comments * disable retry parameter * add retry parameter * address PR comments --------- Co-authored-by: ohmayr <omairnaveed@ymail.com> Co-authored-by: ohmayr <omairn@google.com> * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Towards b/362946071
This PR depends on #701