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

retry parameter ignored in theoperation.result(retry=retry) call #458

Closed
Assignees
vam-google
Labels
priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
@medb

Description

@medb

Environment details

  • OS type and version:Debian 5.18.16
  • Python version:Python 3.10.7
  • pip version:pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
  • google-api-core version:2.10.1

Steps to reproduce

  1. Use any GCP API that returns LRO
  2. Useoperation.result method call with customretry parameter
  3. This method will return ~60 seconds after actual operation finishes, while it should not have more than 10 seconds of overhead with custom retry policy (see below)

Code example

fromgoogle.api_coreimportretryfromgoogle.cloudimportdataproc_v1fromgoogle.api_core.client_optionsimportClientOptionsimporttimeproject='. . .'region='us-central1'# Create Dataproc batchclient_options=ClientOptions(api_endpoint="{}-dataproc.googleapis.com:443".format(region))client=dataproc_v1.BatchControllerClient(client_options=client_options)batch=dataproc_v1.Batch()batch.spark_batch.main_class='org.apache.spark.examples.SparkPi'batch.spark_batch.jar_file_uris= ['file:///usr/lib/spark/examples/jars/spark-examples.jar',]batch.spark_batch.args= ['1']batch.runtime_config.properties= {'spark.executor.instances':'2',}parent=f"projects/{project}/locations/{region}"request=dataproc_v1.CreateBatchRequest(parent=parent,# type: ignorebatch=batch,# type: ignore)# Make the requestprint("Creating batch")operation=client.create_batch(request=request)# type: ignoreprint("Batch created")# This takes quite a while, waiting on GCP response to resolveretry=retry.Retry(initial=10,maximum=10,multiplier=1.0,deadline=600)start=time.time()response=operation.result(retry=retry)print("Batch finished")print(f"Took{time.time()-start} seconds to finish batch job")print(response)

After replacingresponse = operation.result(retry=retry) call with custom wait/retry logic operation completion will be detected as expected:

whilenotoperation.done(retry=None):time.sleep(10)response=operation.metadata

Metadata

Metadata

Assignees

Labels

priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp