diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-08-13 10:53:06 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-08-13 10:53:06 -0700 |
commit | 556775d7c78125e051c6571d4c528de214024c23 (patch) | |
tree | 77d3e0effdb58b01e9e257a8dcd03a024acedf31 /src/python | |
parent | 0ec6973b743e8e1f463bdcc8691e1869097c92f0 (diff) | |
parent | ba7ca9742eb7484009b75c268dba7e56b8feaebb (diff) |
Merge master
Diffstat (limited to 'src/python')
35 files changed, 523 insertions, 37 deletions
diff --git a/src/python/grpcio/grpc/BUILD.bazel b/src/python/grpcio/grpc/BUILD.bazel new file mode 100644 index 0000000000..3f214bf3b0 --- /dev/null +++ b/src/python/grpcio/grpc/BUILD.bazel @@ -0,0 +1,82 @@ +load("@grpc_python_dependencies//:requirements.bzl", "requirement") + +package(default_visibility = ["//visibility:public"]) + +py_binary( + name = "grpcio", + srcs = ["__init__.py"], + deps = [ + ":utilities", + ":auth", + ":plugin_wrapping", + ":channel", + ":interceptor", + ":server", + "//src/python/grpcio/grpc/_cython:cygrpc", + "//src/python/grpcio/grpc/beta", + "//src/python/grpcio/grpc/experimental", + "//src/python/grpcio/grpc/framework", + requirement('enum34'), + requirement('six'), + ], + data = [ + "//:grpc", + ], + main = "__init__.py", + imports = ["../",], +) + +py_library( + name = "auth", + srcs = ["_auth.py"], +) + +py_library( + name = "channel", + srcs = ["_channel.py"], + deps = [ + ":common", + ":grpcio_metadata", + ], +) + +py_library( + name = "common", + srcs = ["_common.py"], +) + +py_library( + name = "grpcio_metadata", + srcs = ["_grpcio_metadata.py"], +) + +py_library( + name = "interceptor", + srcs = ["_interceptor.py"], +) + +py_library( + name = "plugin_wrapping", + srcs = ["_plugin_wrapping.py"], + deps = [ + ":common", + ] +) + +py_library( + name = "server", + srcs = ["_server.py"], + deps = [ + ":common", + ":interceptor", + ], +) + +py_library( + name = "utilities", + srcs = ["_utilities.py"], + deps = [ + ":common", + ], +) + diff --git a/src/python/grpcio/grpc/_cython/BUILD.bazel b/src/python/grpcio/grpc/_cython/BUILD.bazel new file mode 100644 index 0000000000..7124e83dee --- /dev/null +++ b/src/python/grpcio/grpc/_cython/BUILD.bazel @@ -0,0 +1,46 @@ +package(default_visibility = ["//visibility:public"]) + +load("//bazel:cython_library.bzl", "pyx_library") + +pyx_library( + name = "cygrpc", + srcs = [ + "__init__.py", + "cygrpc.pxd", + "cygrpc.pyx", + "_cygrpc/grpc_string.pyx.pxi", + "_cygrpc/arguments.pyx.pxi", + "_cygrpc/call.pyx.pxi", + "_cygrpc/channel.pyx.pxi", + "_cygrpc/credentials.pyx.pxi", + "_cygrpc/completion_queue.pyx.pxi", + "_cygrpc/event.pyx.pxi", + "_cygrpc/metadata.pyx.pxi", + "_cygrpc/operation.pyx.pxi", + "_cygrpc/records.pyx.pxi", + "_cygrpc/security.pyx.pxi", + "_cygrpc/server.pyx.pxi", + "_cygrpc/tag.pyx.pxi", + "_cygrpc/time.pyx.pxi", + "_cygrpc/grpc_gevent.pyx.pxi", + "_cygrpc/grpc.pxi", + "_cygrpc/arguments.pxd.pxi", + "_cygrpc/call.pxd.pxi", + "_cygrpc/channel.pxd.pxi", + "_cygrpc/credentials.pxd.pxi", + "_cygrpc/completion_queue.pxd.pxi", + "_cygrpc/event.pxd.pxi", + "_cygrpc/metadata.pxd.pxi", + "_cygrpc/operation.pxd.pxi", + "_cygrpc/records.pxd.pxi", + "_cygrpc/security.pxd.pxi", + "_cygrpc/server.pxd.pxi", + "_cygrpc/tag.pxd.pxi", + "_cygrpc/time.pxd.pxi", + "_cygrpc/grpc_gevent.pxd.pxi", + ], + deps = [ + "//:grpc", + ], +) + diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pxd.pxi new file mode 100644 index 0000000000..3eb10f5275 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pxd.pxi @@ -0,0 +1,16 @@ +# Copyright 2018 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef object _custom_op_on_c_call(int op, grpc_call *call) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pyx.pxi new file mode 100644 index 0000000000..38cf629dc2 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pyx.pxi @@ -0,0 +1,17 @@ +# Copyright 2018 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef object _custom_op_on_c_call(int op, grpc_call *call): + raise NotImplementedError("No custom hooks are implemented") diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi index 853bf6f8e0..6cb1bc0c05 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi @@ -1,4 +1,4 @@ -# Copyright 2018 gRPC authors. +# Copyright 2018 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,6 +22,12 @@ cdef void _destroy_pointer(void* pointer) cdef int _compare_pointer(void* first_pointer, void* second_pointer) +cdef tuple _wrap_grpc_arg(grpc_arg arg) + + +cdef grpc_arg _unwrap_grpc_arg(tuple wrapped_arg) + + cdef class _ArgumentProcessor: cdef grpc_arg c_argument diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi index aecd3d7b11..2239e26b32 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi @@ -34,6 +34,22 @@ cdef int _compare_pointer(void* first_pointer, void* second_pointer): return 0 +cdef class _GrpcArgWrapper: + + cdef grpc_arg arg + + +cdef tuple _wrap_grpc_arg(grpc_arg arg): + wrapped = _GrpcArgWrapper() + wrapped.arg = arg + return ("grpc.python._cygrpc._GrpcArgWrapper", wrapped) + + +cdef grpc_arg _unwrap_grpc_arg(tuple wrapped_arg): + cdef _GrpcArgWrapper wrapped = wrapped_arg[1] + return wrapped.arg + + cdef class _ArgumentProcessor: cdef void c(self, argument, grpc_arg_pointer_vtable *vtable, references): @@ -51,6 +67,8 @@ cdef class _ArgumentProcessor: if encoded_value is not value: references.append(encoded_value) self.c_argument.value.string = encoded_value + elif isinstance(value, _GrpcArgWrapper): + self.c_argument = (<_GrpcArgWrapper>value).arg elif hasattr(value, '__int__'): # Pointer objects must override __int__() to return # the underlying C address (Python ints are word size). The diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi index 2e02111ddd..a0de862d94 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi @@ -94,3 +94,5 @@ cdef class Call: def is_valid(self): return self.c_call != NULL + def _custom_op_on_c_call(self, int op): + return _custom_op_on_c_call(op, self.c_call) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index 8c37a3cf85..aa187e88a6 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -300,7 +300,7 @@ cdef class SegregatedCall: def next_event(self): def on_success(tag): _process_segregated_call_tag( - self._channel_state, self._call_state, self._c_completion_queue, tag) + self._channel_state, self._call_state, self._c_completion_queue, tag) return _next_call_event( self._channel_state, self._c_completion_queue, on_success) @@ -309,13 +309,18 @@ cdef SegregatedCall _segregated_call( _ChannelState state, int flags, method, host, object deadline, object metadata, CallCredentials credentials, operationses_and_user_tags): cdef _CallState call_state = _CallState() - cdef grpc_completion_queue *c_completion_queue = ( - grpc_completion_queue_create_for_next(NULL)) cdef SegregatedCall segregated_call + cdef grpc_completion_queue *c_completion_queue def on_success(started_tags): state.segregated_call_states.add(call_state) + with state.condition: + if state.open: + c_completion_queue = (grpc_completion_queue_create_for_next(NULL)) + else: + raise ValueError('Cannot invoke RPC on closed channel!') + try: _call( state, call_state, c_completion_queue, on_success, flags, method, host, @@ -443,8 +448,11 @@ cdef class Channel: def check_connectivity_state(self, bint try_to_connect): with self._state.condition: - return grpc_channel_check_connectivity_state( - self._state.c_channel, try_to_connect) + if self._state.open: + return grpc_channel_check_connectivity_state( + self._state.c_channel, try_to_connect) + else: + raise ValueError('Cannot invoke RPC on closed channel!') def watch_connectivity_state( self, grpc_connectivity_state last_observed_state, object deadline): diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pxd b/src/python/grpcio/grpc/_cython/cygrpc.pxd index e33c01c28f..0cc26bc0d0 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pxd +++ b/src/python/grpcio/grpc/_cython/cygrpc.pxd @@ -28,5 +28,6 @@ include "_cygrpc/security.pxd.pxi" include "_cygrpc/server.pxd.pxi" include "_cygrpc/tag.pxd.pxi" include "_cygrpc/time.pxd.pxi" +include "_cygrpc/_hooks.pxd.pxi" include "_cygrpc/grpc_gevent.pxd.pxi" diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx index fb16fb16bf..3cac406687 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pyx +++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx @@ -35,6 +35,7 @@ include "_cygrpc/security.pyx.pxi" include "_cygrpc/server.pyx.pxi" include "_cygrpc/tag.pyx.pxi" include "_cygrpc/time.pyx.pxi" +include "_cygrpc/_hooks.pyx.pxi" include "_cygrpc/grpc_gevent.pyx.pxi" diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index b336e6aae5..c33911ebc1 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.14.0.dev0""" +__version__ = """1.15.0.dev0""" diff --git a/src/python/grpcio/grpc/beta/BUILD.bazel b/src/python/grpcio/grpc/beta/BUILD.bazel new file mode 100644 index 0000000000..731be5cb25 --- /dev/null +++ b/src/python/grpcio/grpc/beta/BUILD.bazel @@ -0,0 +1,58 @@ +load("@grpc_python_dependencies//:requirements.bzl", "requirement") +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "beta", + srcs = ["__init__.py",], + deps = [ + ":client_adaptations", + ":metadata", + ":server_adaptations", + ":implementations", + ":interfaces", + ":utilities", + ], +) + +py_library( + name = "client_adaptations", + srcs = ["_client_adaptations.py"], + imports=["../../",] +) + +py_library( + name = "metadata", + srcs = ["_metadata.py"], +) + +py_library( + name = "server_adaptations", + srcs = ["_server_adaptations.py"], + imports=["../../",], +) + +py_library( + name = "implementations", + srcs = ["implementations.py"], + imports=["../../",], +) + +py_library( + name = "interfaces", + srcs = ["interfaces.py"], + deps = [ + requirement("six"), + ], + imports=["../../",], +) + +py_library( + name = "utilities", + srcs = ["utilities.py"], + deps = [ + ":implementations", + ":interfaces", + "//src/python/grpcio/grpc/framework/foundation", + ], +) + diff --git a/src/python/grpcio/grpc/experimental/BUILD.bazel b/src/python/grpcio/grpc/experimental/BUILD.bazel new file mode 100644 index 0000000000..6598d02747 --- /dev/null +++ b/src/python/grpcio/grpc/experimental/BUILD.bazel @@ -0,0 +1,27 @@ +load("@grpc_python_dependencies//:requirements.bzl", "requirement") +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "experimental", + srcs = ["__init__.py",], + deps = [ + ":gevent", + ":session_cache", + ], +) + +py_library( + name = "gevent", + srcs = ["gevent.py"], + deps = [ + "//src/python/grpcio/grpc/_cython:cygrpc", + ], +) + +py_library( + name = "session_cache", + srcs = ["session_cache.py"], + deps = [ + "//src/python/grpcio/grpc/_cython:cygrpc", + ], +) diff --git a/src/python/grpcio/grpc/framework/BUILD.bazel b/src/python/grpcio/grpc/framework/BUILD.bazel new file mode 100644 index 0000000000..55b4f4d2df --- /dev/null +++ b/src/python/grpcio/grpc/framework/BUILD.bazel @@ -0,0 +1,11 @@ +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "framework", + srcs = ["__init__.py",], + deps = [ + "//src/python/grpcio/grpc/framework/common", + "//src/python/grpcio/grpc/framework/foundation", + "//src/python/grpcio/grpc/framework/interfaces", + ], +) diff --git a/src/python/grpcio/grpc/framework/common/BUILD.bazel b/src/python/grpcio/grpc/framework/common/BUILD.bazel new file mode 100644 index 0000000000..9d9ef682c9 --- /dev/null +++ b/src/python/grpcio/grpc/framework/common/BUILD.bazel @@ -0,0 +1,27 @@ +load("@grpc_python_dependencies//:requirements.bzl", "requirement") +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "common", + srcs = ["__init__.py",], + deps = [ + ":cardinality", + ":style", + ], +) + +py_library( + name = "cardinality", + srcs = ["cardinality.py"], + deps = [ + requirement("enum34"), + ], +) + +py_library( + name = "style", + srcs = ["style.py"], + deps = [ + requirement("enum34"), + ], +) diff --git a/src/python/grpcio/grpc/framework/foundation/BUILD.bazel b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel new file mode 100644 index 0000000000..1287fdd44e --- /dev/null +++ b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel @@ -0,0 +1,61 @@ +load("@grpc_python_dependencies//:requirements.bzl", "requirement") +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "foundation", + srcs = ["__init__.py",], + deps = [ + ":abandonment", + ":callable_util", + ":future", + ":logging_pool", + ":stream_util", + ":stream", + ], +) + +py_library( + name = "abandonment", + srcs = ["abandonment.py"], +) + +py_library( + name = "callable_util", + srcs = ["callable_util.py"], + deps = [ + requirement("enum34"), + requirement("six"), + ], +) + +py_library( + name = "future", + srcs = ["future.py"], + deps = [ + requirement("six"), + ], +) + +py_library( + name = "logging_pool", + srcs = ["logging_pool.py"], + deps = [ + requirement("futures"), + ], +) + +py_library( + name = "stream_util", + srcs = ["stream_util.py"], + deps = [ + ":stream", + ], +) + +py_library( + name = "stream", + srcs = ["stream.py"], + deps = [ + requirement("six"), + ], +) diff --git a/src/python/grpcio/grpc/framework/interfaces/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/BUILD.bazel new file mode 100644 index 0000000000..b81e196cc3 --- /dev/null +++ b/src/python/grpcio/grpc/framework/interfaces/BUILD.bazel @@ -0,0 +1,10 @@ +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "interfaces", + srcs = ["__init__.py",], + deps = [ + "//src/python/grpcio/grpc/framework/interfaces/base", + "//src/python/grpcio/grpc/framework/interfaces/face", + ], +) diff --git a/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel new file mode 100644 index 0000000000..408a66a631 --- /dev/null +++ b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel @@ -0,0 +1,29 @@ +load("@grpc_python_dependencies//:requirements.bzl", "requirement") +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "base_lib", + srcs = ["__init__.py",], + deps = [ + ":base", + ":utilities", + ], +) + +py_library( + name = "base", + srcs = ["base.py"], + deps = [ + "//src/python/grpcio/grpc/framework/foundation:abandonment", + requirement("enum34"), + requirement("six"), + ], +) + +py_library( + name = "utilities", + srcs = ["utilities.py"], + deps = [ + requirement("enum34"), + ], +) diff --git a/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel new file mode 100644 index 0000000000..e683e7cc42 --- /dev/null +++ b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel @@ -0,0 +1,32 @@ +load("@grpc_python_dependencies//:requirements.bzl", "requirement") +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "face", + srcs = ["__init__.py",], + deps = [ + ":face_lib", + ":utilities", + ], +) + +py_library( + name = "face_lib", + srcs = ["face.py"], + deps = [ + "//src/python/grpcio/grpc/framework/foundation", + "//src/python/grpcio/grpc/framework/common", + requirement("enum34"), + requirement("six"), + ], +) + +py_library( + name = "utilities", + srcs = ["utilities.py"], + deps = [ + "//src/python/grpcio/grpc/framework/common", + "//src/python/grpcio/grpc/framework/foundation:stream", + ":face_lib", + ], +) diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 2a74d2a95c..03e1e79464 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -256,6 +256,8 @@ CORE_SOURCE_FILES = [ 'src/core/lib/security/credentials/plugin/plugin_credentials.cc', 'src/core/lib/security/credentials/ssl/ssl_credentials.cc', 'src/core/lib/security/security_connector/alts_security_connector.cc', + 'src/core/lib/security/security_connector/load_system_roots_fallback.cc', + 'src/core/lib/security/security_connector/load_system_roots_linux.cc', 'src/core/lib/security/security_connector/local_security_connector.cc', 'src/core/lib/security/security_connector/security_connector.cc', 'src/core/lib/security/transport/client_auth_filter.cc', @@ -356,8 +358,11 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc', + 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc', + 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc', + 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc', 'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', 'src/cpp/ext/filters/census/grpc_context.cc', diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 2eeaabc8b8..9337800a33 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.14.0.dev0' +VERSION = '1.15.0.dev0' diff --git a/src/python/grpcio_health_checking/grpc_health/v1/health.py b/src/python/grpcio_health_checking/grpc_health/v1/health.py index c8498104b1..0583659428 100644 --- a/src/python/grpcio_health_checking/grpc_health/v1/health.py +++ b/src/python/grpcio_health_checking/grpc_health/v1/health.py @@ -17,11 +17,13 @@ import threading import grpc -from grpc_health.v1 import health_pb2 -from grpc_health.v1 import health_pb2_grpc +from grpc_health.v1 import health_pb2 as _health_pb2 +from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc +SERVICE_NAME = _health_pb2.DESCRIPTOR.services_by_name['Health'].full_name -class HealthServicer(health_pb2_grpc.HealthServicer): + +class HealthServicer(_health_pb2_grpc.HealthServicer): """Servicer handling RPCs for service statuses.""" def __init__(self): @@ -33,9 +35,9 @@ class HealthServicer(health_pb2_grpc.HealthServicer): status = self._server_status.get(request.service) if status is None: context.set_code(grpc.StatusCode.NOT_FOUND) - return health_pb2.HealthCheckResponse() + return _health_pb2.HealthCheckResponse() else: - return health_pb2.HealthCheckResponse(status=status) + return _health_pb2.HealthCheckResponse(status=status) def set(self, service, status): """Sets the status of a service. diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index f36de8d0fa..3b84f7a4c5 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.14.0.dev0' +VERSION = '1.15.0.dev0' diff --git a/src/python/grpcio_health_checking/setup.py b/src/python/grpcio_health_checking/setup.py index 35c09827ba..db2edae2ce 100644 --- a/src/python/grpcio_health_checking/setup.py +++ b/src/python/grpcio_health_checking/setup.py @@ -57,7 +57,7 @@ PACKAGE_DIRECTORIES = { } INSTALL_REQUIRES = ( - 'protobuf>=3.5.2.post1', + 'protobuf>=3.6.0', 'grpcio>={version}'.format(version=grpc_version.VERSION), ) diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py index 0c564f10e5..6df1a36426 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py @@ -17,15 +17,17 @@ import grpc from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pool -from grpc_reflection.v1alpha import reflection_pb2 -from grpc_reflection.v1alpha import reflection_pb2_grpc +from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 +from grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc _POOL = descriptor_pool.Default() +SERVICE_NAME = _reflection_pb2.DESCRIPTOR.services_by_name[ + 'ServerReflection'].full_name def _not_found_error(): - return reflection_pb2.ServerReflectionResponse( - error_response=reflection_pb2.ErrorResponse( + return _reflection_pb2.ServerReflectionResponse( + error_response=_reflection_pb2.ErrorResponse( error_code=grpc.StatusCode.NOT_FOUND.value[0], error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(), )) @@ -35,12 +37,12 @@ def _file_descriptor_response(descriptor): proto = descriptor_pb2.FileDescriptorProto() descriptor.CopyToProto(proto) serialized_proto = proto.SerializeToString() - return reflection_pb2.ServerReflectionResponse( - file_descriptor_response=reflection_pb2.FileDescriptorResponse( + return _reflection_pb2.ServerReflectionResponse( + file_descriptor_response=_reflection_pb2.FileDescriptorResponse( file_descriptor_proto=(serialized_proto,)),) -class ReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer): +class ReflectionServicer(_reflection_pb2_grpc.ServerReflectionServicer): """Servicer handling RPCs for service statuses.""" def __init__(self, service_names, pool=None): @@ -94,17 +96,17 @@ class ReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer): except KeyError: return _not_found_error() else: - return reflection_pb2.ServerReflectionResponse( - all_extension_numbers_response=reflection_pb2. + return _reflection_pb2.ServerReflectionResponse( + all_extension_numbers_response=_reflection_pb2. ExtensionNumberResponse( base_type_name=message_descriptor.full_name, extension_number=extension_numbers)) def _list_services(self): - return reflection_pb2.ServerReflectionResponse( - list_services_response=reflection_pb2.ListServiceResponse( + return _reflection_pb2.ServerReflectionResponse( + list_services_response=_reflection_pb2.ListServiceResponse( service=[ - reflection_pb2.ServiceResponse(name=service_name) + _reflection_pb2.ServiceResponse(name=service_name) for service_name in self._service_names ])) @@ -126,8 +128,8 @@ class ReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer): elif request.HasField('list_services'): yield self._list_services() else: - yield reflection_pb2.ServerReflectionResponse( - error_response=reflection_pb2.ErrorResponse( + yield _reflection_pb2.ServerReflectionResponse( + error_response=_reflection_pb2.ErrorResponse( error_code=grpc.StatusCode.INVALID_ARGUMENT.value[0], error_message=grpc.StatusCode.INVALID_ARGUMENT.value[1] .encode(), @@ -142,5 +144,5 @@ def enable_server_reflection(service_names, server, pool=None): server: grpc.Server to which reflection service will be added. pool: DescriptorPool object to use (descriptor_pool.Default() if None). """ - reflection_pb2_grpc.add_ServerReflectionServicer_to_server( + _reflection_pb2_grpc.add_ServerReflectionServicer_to_server( ReflectionServicer(service_names, pool=pool), server) diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 2249b07d9d..7b0e48ea23 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.14.0.dev0' +VERSION = '1.15.0.dev0' diff --git a/src/python/grpcio_reflection/setup.py b/src/python/grpcio_reflection/setup.py index 589d0ff556..b4087d87b4 100644 --- a/src/python/grpcio_reflection/setup.py +++ b/src/python/grpcio_reflection/setup.py @@ -58,7 +58,7 @@ PACKAGE_DIRECTORIES = { } INSTALL_REQUIRES = ( - 'protobuf>=3.5.2.post1', + 'protobuf>=3.6.0', 'grpcio>={version}'.format(version=grpc_version.VERSION), ) diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index a5b275aff6..df9953fa25 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.14.0.dev0' +VERSION = '1.15.0.dev0' diff --git a/src/python/grpcio_testing/setup.py b/src/python/grpcio_testing/setup.py index eb480a5464..6ceb1fc5c9 100644 --- a/src/python/grpcio_testing/setup.py +++ b/src/python/grpcio_testing/setup.py @@ -29,7 +29,7 @@ PACKAGE_DIRECTORIES = { } INSTALL_REQUIRES = ( - 'protobuf>=3.5.2.post1', + 'protobuf>=3.6.0', 'grpcio>={version}'.format(version=grpc_version.VERSION), ) diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 816dfb55bc..b2cf129e4f 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.14.0.dev0' +VERSION = '1.15.0.dev0' diff --git a/src/python/grpcio_tests/setup.py b/src/python/grpcio_tests/setup.py index 1262e48571..a94c0963ec 100644 --- a/src/python/grpcio_tests/setup.py +++ b/src/python/grpcio_tests/setup.py @@ -41,8 +41,8 @@ INSTALL_REQUIRES = ( 'grpcio>={version}'.format(version=grpc_version.VERSION), 'grpcio-tools>={version}'.format(version=grpc_version.VERSION), 'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION), - 'oauth2client>=1.4.7', 'protobuf>=3.5.2.post1', 'six>=1.10', - 'google-auth>=1.0.0', 'requests>=2.14.2') + 'oauth2client>=1.4.7', 'protobuf>=3.6.0', 'six>=1.10', 'google-auth>=1.0.0', + 'requests>=2.14.2') if not PY3: INSTALL_REQUIRES += ('futures>=2.2.0',) diff --git a/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py b/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py index 3cbbb8de33..350b5eebe5 100644 --- a/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py +++ b/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py @@ -73,6 +73,9 @@ class HealthServicerTest(unittest.TestCase): self.assertEqual(grpc.StatusCode.NOT_FOUND, context.exception.code()) + def test_health_service_name(self): + self.assertEqual(health.SERVICE_NAME, 'grpc.health.v1.Health') + if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py index 7ffdba6a67..bcd9e14a38 100644 --- a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py +++ b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py @@ -171,6 +171,10 @@ class ReflectionServicerTest(unittest.TestCase): for name in _SERVICE_NAMES))),) self.assertSequenceEqual(expected_responses, responses) + def testReflectionServiceName(self): + self.assertEqual(reflection.SERVICE_NAME, + 'grpc.reflection.v1alpha.ServerReflection') + if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/beta/_utilities_test.py b/src/python/grpcio_tests/tests/unit/beta/_utilities_test.py index aebee4da96..e042262796 100644 --- a/src/python/grpcio_tests/tests/unit/beta/_utilities_test.py +++ b/src/python/grpcio_tests/tests/unit/beta/_utilities_test.py @@ -41,6 +41,7 @@ class _Callback(object): return self._value +@unittest.skip('https://github.com/grpc/grpc/issues/16134') class ChannelConnectivityTest(unittest.TestCase): def test_lonely_channel_connectivity(self): diff --git a/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel new file mode 100644 index 0000000000..d69186e1fd --- /dev/null +++ b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel @@ -0,0 +1,17 @@ +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "stream_testing", + srcs = ["stream_testing.py"], +) + +py_test( + name = "logging_pool_test", + srcs = ["_logging_pool_test.py"], + main = "_logging_pool_test.py", + size = "small", + deps = [ + "//src/python/grpcio/grpc:grpcio", + ], +) + |