Basic polling helper function for long running operations/jobs
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)
@tseaver but are the common protos useful outside of the context of using them in grpc?
@garrettjonesgoogle Until recently, gcloud.datastore spoke protobufs-over-HTTPS, rather than protobufs-over-gRPC. We originally picked up the googleapis-common-protos dependency in order to use stuff from google.rpc. status_pb2 and google.type.latlng_pb2.
This might suggest a packaging scheme where we have the message types from Operations in googleapis-common-protos, but create a new googleapis-common-grpc for the non-versioned grpc-generated Interfaces in googleapis, which for now would be just Operations.
@bjwatson and I discussed that last scheme (separating Services from other proto types in the common protos), but that would require modifying the protos (undesirable because we'd need to maintain the restriction that all future common protos have services and types in separate files) or the gRPC codegen (difficult because we do not maintain protoc).
Oh yeah, I forgot that multiple non-Java languages stick the types & operations in a single file.
So, it sounds like this is the choice to make: do we want to (1) be backwards-incompatible (operation messages get moved out into their own package), or (2) have the grpc dependency foisted on everyone? Or maybe (3), update protoc & gRPC codegen for all languages to put types & operations in distinct files, so that we actually have the ability to separate them.
So we decided on option (2). The LRO service methods are now in https://pypi.python.org/pypi/googleapis-common-protos.
@tseaver Can I remove the https://pypi.python.org/pypi/grpc-google-longrunning-v2/ project, since we don't need it?
Please don't delete anything from PyPI unless absolutely necessary (e.g., legal issues). Just update the trove classifiers and mark it as deprecated and possibly publish a new version that warns about deprecation.
Forcing grpc on everyone also seems like a bad choice, and would immediately rule out any usage of this library on GAE Standard for the foreseeable future. /cc @omaray
But does adding a grpc dependency (without using it) actually break consumers?
It's very possible. Even if that's not the case today, it could easily change underneath us. I won't feel comfortable with grpc being a hard requirement until gae has first class support for it.
On Thu, Sep 1, 2016, 5:11 PM garrettjonesgoogle [email protected] wrote:
But does adding a grpc dependency (without using it) actually break consumers?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/gcloud-python/issues/2117#issuecomment-244249247, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPUc-pMuao3l48Lnp9iteZSRKMkjMsmks5ql2msgaJpZM4Jm_rL .
Can it be a soft requirement, with the intent of grpc working on gae as a first class citizen down the road? It becomes a painful package explosion if we have to maintain everything in pairs of packages (message types, grpc service types).
How do you propose it being a "soft" requirement?
On Thu, Sep 1, 2016, 5:20 PM garrettjonesgoogle [email protected] wrote:
Can it be a soft requirement, with the intent of grpc working on gae as a first class citizen down the road? It becomes a painful package explosion if we have to maintain everything in pairs of packages (message types, grpc service types).
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/gcloud-python/issues/2117#issuecomment-244250566, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPUc140GHc8iOn2cEabKX3StJvNZHLpks5ql2vHgaJpZM4Jm_rL .
Python team members - @bjwatson @geigerj - any ideas?
So as it stands today grpc is an extra on this library. Using this library without grpc means that the hand-written clients will work over HTTP. These versions are compatible with GAE Standard.
I know the grpc revolution is coming and essentially all generated APIs will not work without grpc, so I understand the desire to move toward having grpc installed by default, however, we will leave GAE standard behind.
@omaray I feel like this is ultimately your decision. If you're okay with us essentially dropping GAE standard support until the GAE team can add grpc support, then I suppose I am as well.
We need to ensure our Python libraries work on GAE Standard. The current setup was great because it allowed to default back to http in case something was wrong with gRPC. And this applies to other environments too.
So is there another solution?
I've already released 1.3.x of https://pypi.python.org/pypi/googleapis-common-protos with grpcio as a install_requires. @jonparrott if I change this to an extras_require, does that satisfy the needs of our GAE Standard clients?
The alternative is extra engineering work to separate the longrunning messages and services into two separate packages, which is a bit of a fragile post-processing hack we would have to do to the gRPC output (unless they added a feature to explicitly support this mode).
FYI @jmuk. I know you've had similar conversations on the Ruby side.
@bjwatson that could work, this library would have to update the grpc extra to require googleapi-common-protos[grpc]. I'm not 100% sure this will work, so it probably needs to be tested before we go and publish the packages.
(Note: users are already having fun with grpc).
btw testpypi exists for the purposes of testing: https://testpypi.python.org/pypi
thanks @jonparrott. we'll try this out with testpypi