google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

Basic polling helper function for long running operations/jobs

Open elibixby opened this issue 10 years ago • 45 comments

Several libraries with long running operation are lacking basic helper functions for polling

Considering that implementing exponential backoff properly is a 15 line affair which clutters up code it might be good to have a util function that properly implements exponential backoff and then allow things to call it, like in bigquery.job.Jobs

def wait(self):
    utils.exponential_backoff(self.begin, self.reload, self.status)

elibixby avatar Aug 17 '16 23:08 elibixby

@tseaver @jonparrott The updated package with an optional [grpc] dependency is available at https://testpypi.python.org/pypi/googleapis-common-protos (version 1.3.2).

pip install googleapis-common-protos -or- pip install googleapis-common-protos[grpc]

PLMK if this looks good, so I can publish it to the regular pypi.

bjwatson avatar Sep 02 '16 23:09 bjwatson

FYI, the test package has long since been published on regular PyPI. We are currently at 1.3.4.

bjwatson avatar Sep 12 '16 22:09 bjwatson

This exists in gax now, I'm gonna close this.

theacodes avatar Jun 27 '17 19:06 theacodes

Apologies for resurrecting this thread.

I am trying to implement longrunning operation interface for one of my APIs. I tried installing apis-common-protos using googleapis-common-protos and googleapis-common-protos[grpc]. The operations_grpc_pb2.py from installed package does contain client stub, but no servicer interface is available.

Am I missing anything here or are there any specific instructions to generate the same?

asandeep avatar Oct 14 '19 16:10 asandeep

I am bit stuck on this. @bjwatson @theacodes any pointers would be really appreciated.

asandeep avatar Oct 21 '19 15:10 asandeep