Content-Length: 278985 | pFad | http://www.github.com/googleapis/python-bigquery/issues/2210

F2A `LoadJob.result()` ignores its default `retry` · Issue #2210 · googleapis/python-bigquery · GitHub
Skip to content

LoadJob.result() ignores its default retry #2210

Open
@amatissart

Description

@amatissart

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:

kwargs = {} if retry is DEFAULT_RETRY else {"retry": retry}
introduced in #41
and whose expected behavior was broken after the refactoring of Retry in googleapis/python-api-core#462

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/python-bigquery API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://www.github.com/googleapis/python-bigquery/issues/2210

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy