From 68849c86cffd65a38f929d82dcb6a8014689ee60 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Fri, 14 Jun 2019 16:14:07 +0200 Subject: [PATCH] Increase speech max received msg size to 256 MiB --- .../gapic/transports/speech_grpc_transport.py | 5 ++++- speech/synth.metadata | 10 +++++----- speech/synth.py | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/speech/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py b/speech/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py index 62a9116c2843..de2e9294e1a7 100644 --- a/speech/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py +++ b/speech/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py @@ -90,7 +90,10 @@ def create_channel(cls, address="speech.googleapis.com:443", credentials=None): grpc.Channel: A gRPC channel object. """ return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES + address, + credentials=credentials, + scopes=cls._OAUTH_SCOPES, + options={"grpc.max_receive_message_length": 256 * 1024 * 1024}.items(), ) @property diff --git a/speech/synth.metadata b/speech/synth.metadata index 3165226cd1d5..ae6fc4e75587 100644 --- a/speech/synth.metadata +++ b/speech/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-06-14T12:31:03.692038Z", + "updateTime": "2019-06-17T08:38:08.782762Z", "sources": [ { "generator": { "name": "artman", - "version": "0.25.0", - "dockerImage": "googleapis/artman@sha256:ef1a98ab1e2b8f05f4d9a56f27d63347aefe14020e5f2d585172b14ca76f1d90" + "version": "0.26.0", + "dockerImage": "googleapis/artman@sha256:6db0735b0d3beec5b887153a2a7c7411fc7bb53f73f6f389a822096bd14a3a15" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c23b68eecb00c4d285a730a49b1d7d943cd56183", - "internalRef": "253113405" + "sha": "7b58b37559f6a5337c4c564518e9573d742df225", + "internalRef": "253322136" } }, { diff --git a/speech/synth.py b/speech/synth.py index 162248a005aa..11baa4d0632c 100644 --- a/speech/synth.py +++ b/speech/synth.py @@ -1,4 +1,4 @@ -# Copyright 2018 Google LLC +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ # Generate speech GAPIC layer # ---------------------------------------------------------------------------- for version in versions: - library = gapic.py_library("speech", version, include_protos=True,) + library = gapic.py_library("speech", version, include_protos=True) # Don't move over __init__.py, as we modify it to make the generated client # use helpers.py. @@ -55,6 +55,16 @@ r"from google.cloud.speech_\1.gapic import speech_client as speech_\1", ) +# Set the maximum received message size to 256 MiB, the default of 4 MiB is +# often insufficient in practice. +s.replace( + "google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py", + r".*scopes=cls\._OAUTH_SCOPES.*", + """\g<0> + options={"grpc.max_receive_message_length": 256 * 1024 * 1024}.items() + """, +) + # ---------------------------------------------------------------------------- # Add templated files # ----------------------------------------------------------------------------