Skip to content
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: populate default timeout and retry after client-side timeout #896

Merged
merged 12 commits into from Aug 25, 2021
123 changes: 62 additions & 61 deletions google/cloud/bigquery/client.py

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions google/cloud/bigquery/retry.py
Expand Up @@ -29,6 +29,7 @@
exceptions.BadGateway,
requests.exceptions.ChunkedEncodingError,
requests.exceptions.ConnectionError,
requests.exceptions.Timeout,
auth_exceptions.TransportError,
)

Expand Down Expand Up @@ -59,6 +60,13 @@ def _should_retry(exc):
pass ``retry=bigquery.DEFAULT_RETRY.with_deadline(30)``.
"""

DEFAULT_TIMEOUT = 5.0 * 60.0
"""The default API timeout.

This is the time to wait per request. To adjust the total wait time, set a
deadline on the retry object.
"""

job_retry_reasons = "rateLimitExceeded", "backendError"


Expand Down
4 changes: 0 additions & 4 deletions noxfile.py
Expand Up @@ -160,10 +160,6 @@ def snippets(session):
if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false":
session.skip("RUN_SNIPPETS_TESTS is set to false, skipping")

# Sanity check: Only run snippets tests if the environment variable is set.
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed because for most snippets except for the ones that explicitly use a service account key file, the credentials from gcloud work fine. Downloading service account keys is increasingly restricted on internal projects.

session.skip("Credentials must be set via environment variable.")

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
Expand Down