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

Commit 8faa7fc

Browse files
fix: remove gRPC send/recv limit (#12)
1 parent c636859 commit 8faa7fc

File tree

7 files changed

+36
-15
lines changed

7 files changed

+36
-15
lines changed

‎google/cloud/notebooks_v1beta1/services/notebook_service/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = NotebookServiceGrpcTransport
2929
_transport_registry["grpc_asyncio"] = NotebookServiceGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"NotebookServiceTransport",
3433
"NotebookServiceGrpcTransport",

‎google/cloud/notebooks_v1beta1/services/notebook_service/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ def __init__(
150150
ssl_credentials=ssl_credentials,
151151
scopes=scopes or self.AUTH_SCOPES,
152152
quota_project_id=quota_project_id,
153+
options=[
154+
("grpc.max_send_message_length", -1),
155+
("grpc.max_receive_message_length", -1),
156+
],
153157
)
154158
self._ssl_channel_credentials = ssl_credentials
155159
else:
@@ -168,9 +172,14 @@ def __init__(
168172
ssl_credentials=ssl_channel_credentials,
169173
scopes=scopes or self.AUTH_SCOPES,
170174
quota_project_id=quota_project_id,
175+
options=[
176+
("grpc.max_send_message_length", -1),
177+
("grpc.max_receive_message_length", -1),
178+
],
171179
)
172180

173181
self._stubs = {} # type: Dict[str, Callable]
182+
self._operations_client = None
174183

175184
# Run the base constructor.
176185
super().__init__(
@@ -194,7 +203,7 @@ def create_channel(
194203
) -> grpc.Channel:
195204
"""Create and return a gRPC channel object.
196205
Args:
197-
address (Optionsl[str]): The host for the channel to use.
206+
address (Optional[str]): The host for the channel to use.
198207
credentials (Optional[~.Credentials]): The
199208
authorization credentials to attach to requests. These
200209
credentials identify this application to the service. If
@@ -241,13 +250,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
241250
client.
242251
"""
243252
# Sanity check: Only create a new client if we do not already have one.
244-
if "operations_client" not in self.__dict__:
245-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
246-
self.grpc_channel
247-
)
253+
if self._operations_client is None:
254+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
248255

249256
# Return the client from cache.
250-
return self.__dict__["operations_client"]
257+
return self._operations_client
251258

252259
@property
253260
def list_instances(

‎google/cloud/notebooks_v1beta1/services/notebook_service/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ def __init__(
195195
ssl_credentials=ssl_credentials,
196196
scopes=scopes or self.AUTH_SCOPES,
197197
quota_project_id=quota_project_id,
198+
options=[
199+
("grpc.max_send_message_length", -1),
200+
("grpc.max_receive_message_length", -1),
201+
],
198202
)
199203
self._ssl_channel_credentials = ssl_credentials
200204
else:
@@ -213,6 +217,10 @@ def __init__(
213217
ssl_credentials=ssl_channel_credentials,
214218
scopes=scopes or self.AUTH_SCOPES,
215219
quota_project_id=quota_project_id,
220+
options=[
221+
("grpc.max_send_message_length", -1),
222+
("grpc.max_receive_message_length", -1),
223+
],
216224
)
217225

218226
# Run the base constructor.
@@ -226,6 +234,7 @@ def __init__(
226234
)
227235

228236
self._stubs = {}
237+
self._operations_client = None
229238

230239
@property
231240
def grpc_channel(self) -> aio.Channel:
@@ -245,13 +254,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
245254
client.
246255
"""
247256
# Sanity check: Only create a new client if we do not already have one.
248-
if "operations_client" not in self.__dict__:
249-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
257+
if self._operations_client is None:
258+
self._operations_client = operations_v1.OperationsAsyncClient(
250259
self.grpc_channel
251260
)
252261

253262
# Return the client from cache.
254-
return self.__dict__["operations_client"]
263+
return self._operations_client
255264

256265
@property
257266
def list_instances(

‎google/cloud/notebooks_v1beta1/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
DeleteEnvironmentRequest,
4848
)
4949

50-
5150
__all__ = (
5251
"Environment",
5352
"VmImage",

‎notebooks-v1beta1-py.tar.gz

Whitespace-only changes.

‎synth.metadata

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-notebooks.git",
7-
"sha": "8e42088da1eb05c053a8255a2ac36790a95b00d2"
7+
"sha": "c636859c53d40e4be9211e1ced0922395a16d880"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "830887bae22f690647a0fd8b5c9eccd8d6858d74",
15-
"internalRef": "345047174"
14+
"sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907",
15+
"internalRef": "347055288"
1616
}
1717
},
1818
{
@@ -114,7 +114,6 @@
114114
"google/cloud/notebooks_v1beta1/types/instance.py",
115115
"google/cloud/notebooks_v1beta1/types/service.py",
116116
"mypy.ini",
117-
"notebooks-v1beta1-py.tar.gz",
118117
"noxfile.py",
119118
"renovate.json",
120119
"scripts/decrypt-secrets.sh",

‎tests/unit/gapic/notebooks_v1beta1/test_notebook_service.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3555,6 +3555,10 @@ def test_notebook_service_transport_channel_mtls_with_client_cert_source(
35553555
scopes=("https://www.googleapis.com/auth/cloud-platform",),
35563556
ssl_credentials=mock_ssl_cred,
35573557
quota_project_id=None,
3558+
options=[
3559+
("grpc.max_send_message_length", -1),
3560+
("grpc.max_receive_message_length", -1),
3561+
],
35583562
)
35593563
assert transport.grpc_channel == mock_grpc_channel
35603564
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -3596,6 +3600,10 @@ def test_notebook_service_transport_channel_mtls_with_adc(transport_class):
35963600
scopes=("https://www.googleapis.com/auth/cloud-platform",),
35973601
ssl_credentials=mock_ssl_cred,
35983602
quota_project_id=None,
3603+
options=[
3604+
("grpc.max_send_message_length", -1),
3605+
("grpc.max_receive_message_length", -1),
3606+
],
35993607
)
36003608
assert transport.grpc_channel == mock_grpc_channel
36013609

0 commit comments

Comments
 (0)