-
Notifications
You must be signed in to change notification settings - Fork 309
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(metadata): enhance retry logic for metadata server access in _metadata.py #1545
fix(metadata): enhance retry logic for metadata server access in _metadata.py #1545
Conversation
05be25a
to
c29f0f6
Compare
Hi @mrvarmazyar, thank you kindly for your contribution! There exists an exponential backoff implementation in this repo. I think the loop should instead be refactored to use it https://github.com/googleapis/google-auth-library-python/blob/main/google/auth/_exponential_backoff.py. This reduces new code + adds jitter to the retries. |
c29f0f6
to
e64f1ac
Compare
@clundin25 Thank you for your feedback and for pointing me towards the PS: there was also a miss typo in the contribution document |
I think there are two actions remaining.
I think Let me chat with my team on |
Thanks for the suggestion, I'll take a look to learn a bit of its unit tests and then will push the new changes.
I've reviewed the code and understand your point. While you chat with your team, I'll work on proposing the change in the first iteration. |
I pushed two patches here. Going to spend some more time thinking about this tomorrow. |
@clundin25 I have reviewed your code and since you also made adjustments to the tests, should I make any other changes to my code? |
@mrvarmazyar This LGTM. I will update the tests to mock out the calls to sleep. Thank you for your contribution! |
Hello @clundin25, do we have any ETA for merging this PR? I'd like to use it in our Apache Airflow on GKE clusters, and this is why I'm excited to have it 🤩 |
Apologies for the delay. I think this should be released by the end of next week. |
This PR enhances the retry logic in the
_metadata.py
file to handle transient network issues more effectively when accessing the GCE metadata server. The existing retry logic in the ping and get functions have been replaced with theExponentialBackoff
class from_exponential_backoff.py
, which introduces exponential backoff and jitter.