-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Pass kwargs to discovery.build()
when instantiating GSCClient
.
#2291
Pass kwargs to discovery.build()
when instantiating GSCClient
.
#2291
Conversation
1841585
to
97c140e
Compare
@dlstadther These changes are quite simple and would help a lot to debug using the logs. Any possibility of an admin having a look? |
@danthelion could you rebase this branch with the new version of gcs? |
97c140e
to
e802bc3
Compare
@dlstadther Done. |
luigi/contrib/gcs.py
Outdated
else: | ||
self.client = discovery.build('storage', 'v1', cache_discovery=False, **authenticate_kwargs) | ||
self.client = discovery.build('storage', 'v1', **build_kwargs) |
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.
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.
Yes, the original intention of my PR was regarding this parameter a well.
I think it's better to modify it on the client side (by propagating it with build_kwargs
) and True
is always a sane default for caching functionalities.
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.
@himikof Would you like to voice your opinion on moving the default back to True
?
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.
Well, though I in general agree that turning caching on is a sane default in general, I do disagree in this particular case. The discovery caching in googleapiclient
is mostly broken, as indicated in the linked issues, and nobody tried to fix this upstream for several years. The chances of file caching working are even more reduced by #2361 dropping oauth2client
dependency.
The best solution would be to have some kind of simple in-memory cache without external dependencies by default in the upstream googleapiclient
, but I do not believe this is a Luigi issue.
What Luigi can do, though, is to ensure GCP-related functionality works out of the box, without getting scary ImportError
log spam or learning about API discovery caching (which is not that important to know about).
So I would say that getting a way to pass custom discovery kwargs is certainly an improvement, but I feel that Luigi should change the default of the cache_discovery
value, at least until the discovery caching works out of the box in the upstream library. It is a simple matter of doing kwargs.setdefault('cache_discovery', False)
.
e802bc3
to
8d927f4
Compare
@himikof I have added |
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 (ignoring codecov stuff - only care about travis build status)
Description
https://github.com/google/google-api-python-client/blob/89906ac33b37c6017c893841743aa4f45729c91f/googleapiclient/discovery.py#L175
https://github.com/google/google-api-python-client/blob/89906ac33b37c6017c893841743aa4f45729c91f/googleapiclient/discovery.py#L297
The
build
andbuild_from_document
methods has some useful keyword arguments that are currently not useable from theGSCClient
interface.Motivation and Context
My use case for these changes is getting rid of warning log spam because of a default argument (
cache_discovery=True
)googleapis/google-api-python-client#299
googleapis/oauth2client#673
Have you tested this? If so, how?
Locally, running my pipeline with the
cache_discovery=False
argument passed on instantiation.