-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection management support (with optional grpc_gcp dependency) #5553
Connection management support (with optional grpc_gcp dependency) #5553
Conversation
@@ -161,7 +212,7 @@ def create_channel(target, credentials=None, scopes=None, **kwargs): | |||
service. These are only used when credentials are not specified and | |||
are passed to :func:`google.auth.default`. | |||
kwargs: Additional key-word args passed to | |||
:func:`google.auth.transport.grpc.secure_authorized_channel`. | |||
:func:`_create_secure_channel`. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -149,6 +154,52 @@ def wrap_errors(callable_): | |||
return _wrap_unary_errors(callable_) | |||
|
|||
|
|||
def _create_secure_channel( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
options = None | ||
|
||
if HAS_GRPC_GCP: | ||
# Initialize grpc gcp config for spanner api. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
… channel config, add system tests with grpc_gcp
Hi @theacodes , I have made some changes as requested. Please take a look, thanks! |
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.
Looking almost ready. Sorry for the delay on reviewing.
def create_channel(target, | ||
credentials=None, | ||
scopes=None, | ||
ssl_credentials=None, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
options = None | ||
|
||
if HAS_GRPC_GCP: | ||
# Initialize grpc gcp config for spanner api. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Hi @theacodes , can you take a look at the new changes? |
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.
Looks almost good.
@mock.patch( | ||
'google.auth.default', | ||
return_value=(mock.sentinel.credentials, mock.sentinel.projet)) | ||
@mock.patch('google.auth.transport.grpc.secure_authorized_channel') | ||
def test_create_channel_implicit(secure_authorized_channel, default): | ||
@mock.patch('grpc._channel.Channel') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Add optional grpc_gcp dependency for api_core and spanner_v1. If user has installed grpcio-gcp, then the connection management feature will be enabled, and with the configuration specified in spanner.grpc.config . Otherwise, grpc_gcp won't be imported and everything works as usual.