Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit a1727c3

Browse files
fix: remove client recv msg limit
PiperOrigin-RevId: 347055288 Source-Author: Google APIs <noreply@google.com> Source-Date: Fri Dec 11 12:44:37 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: dd372aa22ded7a8ba6f0e03a80e06358a3fa0907 Source-Link: googleapis/googleapis@dd372aa
1 parent 634875d commit a1727c3

File tree

6 files changed

+36
-14
lines changed

6 files changed

+36
-14
lines changed

google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = CloudBuildGrpcTransport
2929
_transport_registry["grpc_asyncio"] = CloudBuildGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"CloudBuildTransport",
3433
"CloudBuildGrpcTransport",

google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ def __init__(
156156
ssl_credentials=ssl_credentials,
157157
scopes=scopes or self.AUTH_SCOPES,
158158
quota_project_id=quota_project_id,
159+
options=[
160+
("grpc.max_send_message_length", -1),
161+
("grpc.max_receive_message_length", -1),
162+
],
159163
)
160164
self._ssl_channel_credentials = ssl_credentials
161165
else:
@@ -174,9 +178,14 @@ def __init__(
174178
ssl_credentials=ssl_channel_credentials,
175179
scopes=scopes or self.AUTH_SCOPES,
176180
quota_project_id=quota_project_id,
181+
options=[
182+
("grpc.max_send_message_length", -1),
183+
("grpc.max_receive_message_length", -1),
184+
],
177185
)
178186

179187
self._stubs = {} # type: Dict[str, Callable]
188+
self._operations_client = None
180189

181190
# Run the base constructor.
182191
super().__init__(
@@ -200,7 +209,7 @@ def create_channel(
200209
) -> grpc.Channel:
201210
"""Create and return a gRPC channel object.
202211
Args:
203-
address (Optionsl[str]): The host for the channel to use.
212+
address (Optional[str]): The host for the channel to use.
204213
credentials (Optional[~.Credentials]): The
205214
authorization credentials to attach to requests. These
206215
credentials identify this application to the service. If
@@ -247,13 +256,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
247256
client.
248257
"""
249258
# Sanity check: Only create a new client if we do not already have one.
250-
if "operations_client" not in self.__dict__:
251-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
252-
self.grpc_channel
253-
)
259+
if self._operations_client is None:
260+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
254261

255262
# Return the client from cache.
256-
return self.__dict__["operations_client"]
263+
return self._operations_client
257264

258265
@property
259266
def create_build(

google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ def __init__(
201201
ssl_credentials=ssl_credentials,
202202
scopes=scopes or self.AUTH_SCOPES,
203203
quota_project_id=quota_project_id,
204+
options=[
205+
("grpc.max_send_message_length", -1),
206+
("grpc.max_receive_message_length", -1),
207+
],
204208
)
205209
self._ssl_channel_credentials = ssl_credentials
206210
else:
@@ -219,6 +223,10 @@ def __init__(
219223
ssl_credentials=ssl_channel_credentials,
220224
scopes=scopes or self.AUTH_SCOPES,
221225
quota_project_id=quota_project_id,
226+
options=[
227+
("grpc.max_send_message_length", -1),
228+
("grpc.max_receive_message_length", -1),
229+
],
222230
)
223231

224232
# Run the base constructor.
@@ -232,6 +240,7 @@ def __init__(
232240
)
233241

234242
self._stubs = {}
243+
self._operations_client = None
235244

236245
@property
237246
def grpc_channel(self) -> aio.Channel:
@@ -251,13 +260,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
251260
client.
252261
"""
253262
# Sanity check: Only create a new client if we do not already have one.
254-
if "operations_client" not in self.__dict__:
255-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
263+
if self._operations_client is None:
264+
self._operations_client = operations_v1.OperationsAsyncClient(
256265
self.grpc_channel
257266
)
258267

259268
# Return the client from cache.
260-
return self.__dict__["operations_client"]
269+
return self._operations_client
261270

262271
@property
263272
def create_build(

google/cloud/devtools/cloudbuild_v1/types/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
ListWorkerPoolsResponse,
6262
)
6363

64-
6564
__all__ = (
6665
"RetryBuildRequest",
6766
"RunBuildTriggerRequest",

synth.metadata

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-cloudbuild.git",
7-
"sha": "b714dfe9f8c21739c7031fc3a642ca8d57f120d7"
7+
"sha": "634875d8ade72a93c08f43d6c093539c61349927"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "1f22d1e9654a2588aa32f3802156d965d8d1f10f",
15-
"internalRef": "340738401"
14+
"sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907",
15+
"internalRef": "347055288"
1616
}
1717
},
1818
{

tests/unit/gapic/cloudbuild_v1/test_cloud_build.py

+8
Original file line numberDiff line numberDiff line change
@@ -3377,6 +3377,10 @@ def test_cloud_build_transport_channel_mtls_with_client_cert_source(transport_cl
33773377
scopes=("https://www.googleapis.com/auth/cloud-platform",),
33783378
ssl_credentials=mock_ssl_cred,
33793379
quota_project_id=None,
3380+
options=[
3381+
("grpc.max_send_message_length", -1),
3382+
("grpc.max_receive_message_length", -1),
3383+
],
33803384
)
33813385
assert transport.grpc_channel == mock_grpc_channel
33823386
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -3415,6 +3419,10 @@ def test_cloud_build_transport_channel_mtls_with_adc(transport_class):
34153419
scopes=("https://www.googleapis.com/auth/cloud-platform",),
34163420
ssl_credentials=mock_ssl_cred,
34173421
quota_project_id=None,
3422+
options=[
3423+
("grpc.max_send_message_length", -1),
3424+
("grpc.max_receive_message_length", -1),
3425+
],
34183426
)
34193427
assert transport.grpc_channel == mock_grpc_channel
34203428

0 commit comments

Comments
 (0)