Open
Description
Environment details
- OS type and version: Fedora Linux 42
- Python version: 3.13.3
- pip version: 24.3.1
google-cloud-bigquery
version: 3.34.0
Steps to reproduce
Here is a failing unit test, to add in "test_job_retry.py".
The test fails with the DEFAULT_RETRY
, and passes with a copy of the object.
@pytest.mark.parametrize(
"result_retry",
[
pytest.param(
{},
id="default retry",
),
pytest.param(
{"retry": google.cloud.bigquery.retry.DEFAULT_RETRY.with_timeout(timeout=10.0)},
id="custom retry object",
),
],
)
def test_retry_load_job_result(result_retry, PROJECT, DS_ID):
from google.cloud.bigquery.dataset import DatasetReference
from google.cloud.bigquery.job.load import LoadJob
client = make_client()
conn = client._connection = make_connection(
dict(
status=dict(state="RUNNING"),
jobReference={"jobId": "id_1"},
),
google.api_core.exceptions.ServiceUnavailable("retry me"),
dict(
status=dict(state="DONE"),
jobReference={"jobId": "id_1"},
statistics={"load": {"outputRows": 1}},
),
)
table_ref = DatasetReference(project=PROJECT, dataset_id=DS_ID).table("new_table")
job = LoadJob("id_1", source_uris=None, destination=table_ref, client=client)
result = job.result(**result_retry)
assert job.state == "DONE"
assert result.output_rows == 1
# We made all the calls we expected to.
assert conn.api_request.call_count == 3
The culprit appears to be this line:
python-bigquery/google/cloud/bigquery/job/base.py
Line 1000 in eb9c2af
and whose expected behavior was broken after the refactoring of Retry in googleapis/python-api-core#462