Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5573579

Browse files
authored
fix: ensure query job retry has longer deadline than API request deadline (#1734)
In cases where we can't disambiguate API failure from job failure,this ensures we can still retry the job at least once.
1 parent6290517 commit5573579

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

‎google/cloud/bigquery/retry.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@
3434
auth_exceptions.TransportError,
3535
)
3636

37-
_DEFAULT_JOB_DEADLINE=60.0*10.0# seconds
37+
_DEFAULT_RETRY_DEADLINE=10.0*60.0# 10 minutes
38+
39+
# Allow for a few retries after the API request times out. This relevant for
40+
# rateLimitExceeded errors, which can be raised either by the Google load
41+
# balancer or the BigQuery job server.
42+
_DEFAULT_JOB_DEADLINE=3.0*_DEFAULT_RETRY_DEADLINE
3843

3944

4045
def_should_retry(exc):
@@ -51,7 +56,7 @@ def _should_retry(exc):
5156
returnreasonin_RETRYABLE_REASONS
5257

5358

54-
DEFAULT_RETRY=retry.Retry(predicate=_should_retry,deadline=600.0)
59+
DEFAULT_RETRY=retry.Retry(predicate=_should_retry,deadline=_DEFAULT_RETRY_DEADLINE)
5560
"""The default retry object.
5661
5762
Any method with a ``retry`` parameter will be retried automatically,

‎tests/unit/test_retry.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def test_DEFAULT_JOB_RETRY_predicate():
125125

126126

127127
deftest_DEFAULT_JOB_RETRY_deadline():
128-
fromgoogle.cloud.bigquery.retryimportDEFAULT_JOB_RETRY
128+
fromgoogle.cloud.bigquery.retryimportDEFAULT_JOB_RETRY,DEFAULT_RETRY
129129

130-
assertDEFAULT_JOB_RETRY._deadline==600
130+
# Make sure we can retry the job at least once.
131+
assertDEFAULT_JOB_RETRY._deadline>DEFAULT_RETRY._deadline

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp