-
Notifications
You must be signed in to change notification settings - Fork 18
Only build common protos with --grpc option for LRO. #109
Conversation
@jmuk @garrettjonesgoogle @jskeet @vchudnov-g @pongad, do any of your languages have standalone |
Current coverage is 91.73% (diff: 75.00%)@@ master #109 diff @@
==========================================
Files 3 3
Lines 711 714 +3
Methods 150 150
Messages 0 0
Branches 111 113 +2
==========================================
+ Hits 652 655 +3
Misses 59 59
Partials 0 0
|
} else { | ||
args.push('--grpc_out=' + outDir); | ||
if (!opts.buildCommonProtos || | ||
_.includes(COMMON_GRPC_PROTOS, protoPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this the path from the proto's rootdir (i.e. 'google/longrunning/operations.proto')?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's just the last element. pkg
has the path.
This looks a bit weird, could be a bug of grpc tools for Python. Are there any bugs in grpc? |
@jmuk Does gRPC codegen make the grpc imports conditional on actually using gRPC for other languages? |
@jmuk I checked Ruby and saw that it generates the message and services in different files, which avoids this problem. @garrettjonesgoogle told me the same thing for Java, thanks to their rigid one-class-per-file policy. |
That's right (although I didn't know what Java does). If Python generator needs to generate single file containing both message and service definition -- then, Python generator should add grpc import line conditionally. |
@bjwatson: Our "common types" (Google.Api.CommonProtos) package includes the LRO definition, but not any gRPC code for it. I'd anticipate putting that in a separate package which then depends on Google.Api.CommonProtos. At the moment, I don't think any of these packages are produced by the pipeline, although we may well want to change this at some point... |
@bjwatson , java has google-grpc-common-protos, which is including the Operations Grpc generated code now. |
@garrettjonesgoogle So do you have two packages for the Java common protos: one with just the messages, and one with the full gRPC build? Where can I find them? |
@jskeet A potential problem with that approach is if the |
The gRPC proto plugin for C# only generates the services - we should be fine. |
@bjwatson , we have a single package with both the common protos and the gRPC-generated class for Operations. http://search.maven.org/#artifactdetails%7Ccom.google.api.grpc%7Cgrpc-google-common-protos%7C0.0.9%7Cjar |
@garrettjonesgoogle So googleapis-common-protos has been abandoned? I assume you don't have any concerns about adding a gRPC dependency, because gRPC works fine with the Java version of GAE Standard, right? |
@bjwatson Yes, the java repo googleapis-common-protos is abandoned now. I haven't tried this with GAE standard; theoretically it shouldn't cause an issue to have dependencies that are unused (although if someone tried to use the gRPC dependency directly, I think it wouldn't work). |
@garrettjonesgoogle I was having problems with our gcloud-python users on GAE Standard (e.g. googleapis/google-cloud-python#1893 (comment)), so I'm having to do more to make gRPC a soft dependency in the Python version of googleapis-common-protos. Hopefully you don't run into the same problems. Has |
@bjwatson |
Including the gRPC dependency in C# would be less desirable, I think - it's a large package due to the native binaries involved, so anywhere you don't need it, you really don't want it. That said, if all the other platforms take that approach, there are benefits in consistency, and there are relatively few places you'd want the common protos without gRPC at the moment... |
@jskeet The primary driver right now for this in Python and other languages is supporting Speech v1beta1. The AsyncRecognize method is the primary method for the API that we need to support, and it returns an LRO object. Our gcloud counterparts need the gRPC service methods for LRO to make this work. There will probably also be other APIs that drive the need for LRO. |
@garrettjonesgoogle That's good to hear. google-cloud-python has always had a soft dependency on gax-python, to avoid pulling in gRPC for HTTP1.1-only clients. Seems like Java doesn't have that requirement. |
@bjwatson: Yes, we need LRO in C# as well. The options are:
We definitely need it one way or another; it's just which route we go down. But maybe that would be better discussion away from this PR. |
@jskeet Sounds good. We've been wrestling with both LRO and IAM in the other languages, too. Your choice of venue to continue this conversation. :) |
84f6383
to
7c1ba99
Compare
_.includes(COMMON_GRPC_PROTOS, protoPath)) { | ||
if (language === 'python') { | ||
// required per https://github.com/grpc/grpc/issues/7857 | ||
args.push('--grpc_python_out=' + outDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we decided not to do this in order to support GAE?
My understanding was that this required a more complex change to generate both gRPC and gRPC-less modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After offline discussion, I understand that this is actually an improvement over the current state of master, where every common proto is being built with the gRPC plugin (and hence is potentially GAE-incompatible).
LGTM, with a nit. |
LGTM, although would like to get to a state without hand-edits as soon as we can to reduce the risk of accidents when regenerating the package. |
@jmuk I fixed your nit. PTAL |
LGTM |
Updates googleapis/google-cloud-python#1893 (comment)
grpc/grpc#8056 is a proposal to fix this issue in gRPC (FYI @jmuk)