From 0e0383ad0cf03f667deeecb3c3af54ee806b455e Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Mon, 22 Feb 2021 15:41:48 +0100 Subject: [PATCH 1/2] docs: explain retry behavior for DONE jobs --- google/cloud/bigquery/job/base.py | 8 ++++++-- google/cloud/bigquery/job/query.py | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/google/cloud/bigquery/job/base.py b/google/cloud/bigquery/job/base.py index d8f5d6528..f24e972c8 100644 --- a/google/cloud/bigquery/job/base.py +++ b/google/cloud/bigquery/job/base.py @@ -614,7 +614,9 @@ def done(self, retry=DEFAULT_RETRY, timeout=None, reload=True): """Checks if the job is complete. Args: - retry (Optional[google.api_core.retry.Retry]): How to retry the RPC. + retry (Optional[google.api_core.retry.Retry]): + How to retry the RPC. If the job state is ``DONE``, retrying is aborted + early, as the job will not change anymore. timeout (Optional[float]): The number of seconds to wait for the underlying HTTP transport before using ``retry``. @@ -635,7 +637,9 @@ def result(self, retry=DEFAULT_RETRY, timeout=None): """Start the job and wait for it to complete and get the result. Args: - retry (Optional[google.api_core.retry.Retry]): How to retry the RPC. + retry (Optional[google.api_core.retry.Retry]): + How to retry the RPC. If the job state is ``DONE``, retrying is aborted + early, as the job will not change anymore. timeout (Optional[float]): The number of seconds to wait for the underlying HTTP transport before using ``retry``. diff --git a/google/cloud/bigquery/job/query.py b/google/cloud/bigquery/job/query.py index d87f87f52..3a98c9e60 100644 --- a/google/cloud/bigquery/job/query.py +++ b/google/cloud/bigquery/job/query.py @@ -979,7 +979,8 @@ def done(self, retry=DEFAULT_RETRY, timeout=None, reload=True): Args: retry (Optional[google.api_core.retry.Retry]): - How to retry the call that retrieves query results. + How to retry the call that retrieves query results. If the job state is + ``DONE``, retrying is aborted early, as the job will not change anymore. timeout (Optional[float]): The number of seconds to wait for the underlying HTTP transport before using ``retry``. @@ -1128,7 +1129,9 @@ def result( max_results (Optional[int]): The maximum total number of rows from this request. retry (Optional[google.api_core.retry.Retry]): - How to retry the call that retrieves rows. + How to retry the call that retrieves rows. If the job state is + ``DONE``, retrying is aborted early even if the results are not + availalbe, as this will not change anymore. timeout (Optional[float]): The number of seconds to wait for the underlying HTTP transport before using ``retry``. From e061e1bf7405a34074c26f56696ada909cd3be60 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Mon, 22 Feb 2021 16:37:44 -0600 Subject: [PATCH 2/2] Update google/cloud/bigquery/job/query.py --- google/cloud/bigquery/job/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/bigquery/job/query.py b/google/cloud/bigquery/job/query.py index 3a98c9e60..b3ca8d940 100644 --- a/google/cloud/bigquery/job/query.py +++ b/google/cloud/bigquery/job/query.py @@ -1131,7 +1131,7 @@ def result( retry (Optional[google.api_core.retry.Retry]): How to retry the call that retrieves rows. If the job state is ``DONE``, retrying is aborted early even if the results are not - availalbe, as this will not change anymore. + available, as this will not change anymore. timeout (Optional[float]): The number of seconds to wait for the underlying HTTP transport before using ``retry``.