DBFS API 429 retries: Wrap retry logic in a class to ensure isolation between decorated function calls.#327
Merged
bogdanghita-db merged 7 commits intodatabricks:masterfrom Oct 6, 2020
Conversation
This reverts commit 23cdb52.
bogdanghita-db
commented
Sep 24, 2020
| self.client = DbfsService(api_client) | ||
|
|
||
| @retry_429 | ||
| @Retry429 |
Collaborator
Author
There was a problem hiding this comment.
It's a class now, so name must be camel case.
andrewmchen
approved these changes
Oct 2, 2020
bogdanghita-db
added a commit
to bogdanghita-db/databricks-cli
that referenced
this pull request
Oct 16, 2020
…solation between decorated function calls. (databricks#327)" This reverts commit 6e2da08.
bogdanghita-db
added a commit
that referenced
this pull request
Oct 20, 2020
…all databricks-cli operations (#343) Revert retry logic on 429 responses for DBFS API requests (#319, #326, #327) and reimplement it using [urllib3.util.Retry](https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html), for all the requests made by `databricks-cli`. * We perform a maximum number of 6 retries with exponential backoff, resulting in the following delays between them: 0.5, 1, 2, 4, 8, 16 (seconds). The `Retry-After` header is respected if present. * There is no message logged for each retry (I could not find a way to do it using `urllib3.util.Retry`). * If all retry attempts fail, the original 429 http response is forwarded by the retry utility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the
retry_429decorator, changing it from a function to a class, such that we can persist thetime_for_last_retryseparately for each decorated function, instead of using a global variable.Manually tested and user experience is unchanged: