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

Commit 4a2e2cf

Browse files
fix: remove gRPC send/recv limits; add enums to types/__init__.py (#108)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * fix: remove client recv msg limit fix: add enums to `types/__init__.py` 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 * chore: Remove unused 'package' attr from java_gapic_library rules Committer: @miraleung PiperOrigin-RevId: 347459563 Source-Author: Google APIs <noreply@google.com> Source-Date: Mon Dec 14 13:41:09 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 6dae98144d466d4f985b926baec6208b01572f55 Source-Link: googleapis/googleapis@6dae981 Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
1 parent ca2b8f1 commit 4a2e2cf

File tree

20 files changed

+143
-47
lines changed

20 files changed

+143
-47
lines changed

google/cloud/automl_v1/services/auto_ml/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"] = AutoMlGrpcTransport
2929
_transport_registry["grpc_asyncio"] = AutoMlGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"AutoMlTransport",
3433
"AutoMlGrpcTransport",

google/cloud/automl_v1/services/auto_ml/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ def __init__(
168168
ssl_credentials=ssl_credentials,
169169
scopes=scopes or self.AUTH_SCOPES,
170170
quota_project_id=quota_project_id,
171+
options=[
172+
("grpc.max_send_message_length", -1),
173+
("grpc.max_receive_message_length", -1),
174+
],
171175
)
172176
self._ssl_channel_credentials = ssl_credentials
173177
else:
@@ -186,9 +190,14 @@ def __init__(
186190
ssl_credentials=ssl_channel_credentials,
187191
scopes=scopes or self.AUTH_SCOPES,
188192
quota_project_id=quota_project_id,
193+
options=[
194+
("grpc.max_send_message_length", -1),
195+
("grpc.max_receive_message_length", -1),
196+
],
189197
)
190198

191199
self._stubs = {} # type: Dict[str, Callable]
200+
self._operations_client = None
192201

193202
# Run the base constructor.
194203
super().__init__(
@@ -212,7 +221,7 @@ def create_channel(
212221
) -> grpc.Channel:
213222
"""Create and return a gRPC channel object.
214223
Args:
215-
address (Optionsl[str]): The host for the channel to use.
224+
address (Optional[str]): The host for the channel to use.
216225
credentials (Optional[~.Credentials]): The
217226
authorization credentials to attach to requests. These
218227
credentials identify this application to the service. If
@@ -259,13 +268,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
259268
client.
260269
"""
261270
# Sanity check: Only create a new client if we do not already have one.
262-
if "operations_client" not in self.__dict__:
263-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
264-
self.grpc_channel
265-
)
271+
if self._operations_client is None:
272+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
266273

267274
# Return the client from cache.
268-
return self.__dict__["operations_client"]
275+
return self._operations_client
269276

270277
@property
271278
def create_dataset(

google/cloud/automl_v1/services/auto_ml/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ def __init__(
213213
ssl_credentials=ssl_credentials,
214214
scopes=scopes or self.AUTH_SCOPES,
215215
quota_project_id=quota_project_id,
216+
options=[
217+
("grpc.max_send_message_length", -1),
218+
("grpc.max_receive_message_length", -1),
219+
],
216220
)
217221
self._ssl_channel_credentials = ssl_credentials
218222
else:
@@ -231,6 +235,10 @@ def __init__(
231235
ssl_credentials=ssl_channel_credentials,
232236
scopes=scopes or self.AUTH_SCOPES,
233237
quota_project_id=quota_project_id,
238+
options=[
239+
("grpc.max_send_message_length", -1),
240+
("grpc.max_receive_message_length", -1),
241+
],
234242
)
235243

236244
# Run the base constructor.
@@ -244,6 +252,7 @@ def __init__(
244252
)
245253

246254
self._stubs = {}
255+
self._operations_client = None
247256

248257
@property
249258
def grpc_channel(self) -> aio.Channel:
@@ -263,13 +272,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
263272
client.
264273
"""
265274
# Sanity check: Only create a new client if we do not already have one.
266-
if "operations_client" not in self.__dict__:
267-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
275+
if self._operations_client is None:
276+
self._operations_client = operations_v1.OperationsAsyncClient(
268277
self.grpc_channel
269278
)
270279

271280
# Return the client from cache.
272-
return self.__dict__["operations_client"]
281+
return self._operations_client
273282

274283
@property
275284
def create_dataset(

google/cloud/automl_v1/services/prediction_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"] = PredictionServiceGrpcTransport
2929
_transport_registry["grpc_asyncio"] = PredictionServiceGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"PredictionServiceTransport",
3433
"PredictionServiceGrpcTransport",

google/cloud/automl_v1/services/prediction_service/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def __init__(
151151
ssl_credentials=ssl_credentials,
152152
scopes=scopes or self.AUTH_SCOPES,
153153
quota_project_id=quota_project_id,
154+
options=[
155+
("grpc.max_send_message_length", -1),
156+
("grpc.max_receive_message_length", -1),
157+
],
154158
)
155159
self._ssl_channel_credentials = ssl_credentials
156160
else:
@@ -169,9 +173,14 @@ def __init__(
169173
ssl_credentials=ssl_channel_credentials,
170174
scopes=scopes or self.AUTH_SCOPES,
171175
quota_project_id=quota_project_id,
176+
options=[
177+
("grpc.max_send_message_length", -1),
178+
("grpc.max_receive_message_length", -1),
179+
],
172180
)
173181

174182
self._stubs = {} # type: Dict[str, Callable]
183+
self._operations_client = None
175184

176185
# Run the base constructor.
177186
super().__init__(
@@ -195,7 +204,7 @@ def create_channel(
195204
) -> grpc.Channel:
196205
"""Create and return a gRPC channel object.
197206
Args:
198-
address (Optionsl[str]): The host for the channel to use.
207+
address (Optional[str]): The host for the channel to use.
199208
credentials (Optional[~.Credentials]): The
200209
authorization credentials to attach to requests. These
201210
credentials identify this application to the service. If
@@ -242,13 +251,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
242251
client.
243252
"""
244253
# Sanity check: Only create a new client if we do not already have one.
245-
if "operations_client" not in self.__dict__:
246-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
247-
self.grpc_channel
248-
)
254+
if self._operations_client is None:
255+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
249256

250257
# Return the client from cache.
251-
return self.__dict__["operations_client"]
258+
return self._operations_client
252259

253260
@property
254261
def predict(

google/cloud/automl_v1/services/prediction_service/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ def __init__(
196196
ssl_credentials=ssl_credentials,
197197
scopes=scopes or self.AUTH_SCOPES,
198198
quota_project_id=quota_project_id,
199+
options=[
200+
("grpc.max_send_message_length", -1),
201+
("grpc.max_receive_message_length", -1),
202+
],
199203
)
200204
self._ssl_channel_credentials = ssl_credentials
201205
else:
@@ -214,6 +218,10 @@ def __init__(
214218
ssl_credentials=ssl_channel_credentials,
215219
scopes=scopes or self.AUTH_SCOPES,
216220
quota_project_id=quota_project_id,
221+
options=[
222+
("grpc.max_send_message_length", -1),
223+
("grpc.max_receive_message_length", -1),
224+
],
217225
)
218226

219227
# Run the base constructor.
@@ -227,6 +235,7 @@ def __init__(
227235
)
228236

229237
self._stubs = {}
238+
self._operations_client = None
230239

231240
@property
232241
def grpc_channel(self) -> aio.Channel:
@@ -246,13 +255,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
246255
client.
247256
"""
248257
# Sanity check: Only create a new client if we do not already have one.
249-
if "operations_client" not in self.__dict__:
250-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
258+
if self._operations_client is None:
259+
self._operations_client = operations_v1.OperationsAsyncClient(
251260
self.grpc_channel
252261
)
253262

254263
# Return the client from cache.
255-
return self.__dict__["operations_client"]
264+
return self._operations_client
256265

257266
@property
258267
def predict(

google/cloud/automl_v1/types/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .classification import (
1919
ClassificationAnnotation,
2020
ClassificationEvaluationMetrics,
21+
ClassificationType,
2122
)
2223
from .geometry import (
2324
NormalizedVertex,
@@ -123,10 +124,10 @@
123124
ListModelEvaluationsResponse,
124125
)
125126

126-
127127
__all__ = (
128128
"ClassificationAnnotation",
129129
"ClassificationEvaluationMetrics",
130+
"ClassificationType",
130131
"NormalizedVertex",
131132
"BoundingPoly",
132133
"ImageObjectDetectionAnnotation",

google/cloud/automl_v1beta1/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
"AnnotationPayload",
150150
"AnnotationSpec",
151151
"ArrayStats",
152-
"AutoMlClient",
153152
"BatchPredictInputConfig",
154153
"BatchPredictOperationMetadata",
155154
"BatchPredictOutputConfig",
@@ -228,6 +227,7 @@
228227
"OutputConfig",
229228
"PredictRequest",
230229
"PredictResponse",
230+
"PredictionServiceClient",
231231
"RegressionEvaluationMetrics",
232232
"Row",
233233
"StringStats",
@@ -269,5 +269,5 @@
269269
"VideoObjectTrackingDatasetMetadata",
270270
"VideoObjectTrackingEvaluationMetrics",
271271
"VideoObjectTrackingModelMetadata",
272-
"PredictionServiceClient",
272+
"AutoMlClient",
273273
)

google/cloud/automl_v1beta1/services/auto_ml/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"] = AutoMlGrpcTransport
2929
_transport_registry["grpc_asyncio"] = AutoMlGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"AutoMlTransport",
3433
"AutoMlGrpcTransport",

google/cloud/automl_v1beta1/services/auto_ml/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ def __init__(
171171
ssl_credentials=ssl_credentials,
172172
scopes=scopes or self.AUTH_SCOPES,
173173
quota_project_id=quota_project_id,
174+
options=[
175+
("grpc.max_send_message_length", -1),
176+
("grpc.max_receive_message_length", -1),
177+
],
174178
)
175179
self._ssl_channel_credentials = ssl_credentials
176180
else:
@@ -189,9 +193,14 @@ def __init__(
189193
ssl_credentials=ssl_channel_credentials,
190194
scopes=scopes or self.AUTH_SCOPES,
191195
quota_project_id=quota_project_id,
196+
options=[
197+
("grpc.max_send_message_length", -1),
198+
("grpc.max_receive_message_length", -1),
199+
],
192200
)
193201

194202
self._stubs = {} # type: Dict[str, Callable]
203+
self._operations_client = None
195204

196205
# Run the base constructor.
197206
super().__init__(
@@ -215,7 +224,7 @@ def create_channel(
215224
) -> grpc.Channel:
216225
"""Create and return a gRPC channel object.
217226
Args:
218-
address (Optionsl[str]): The host for the channel to use.
227+
address (Optional[str]): The host for the channel to use.
219228
credentials (Optional[~.Credentials]): The
220229
authorization credentials to attach to requests. These
221230
credentials identify this application to the service. If
@@ -262,13 +271,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
262271
client.
263272
"""
264273
# Sanity check: Only create a new client if we do not already have one.
265-
if "operations_client" not in self.__dict__:
266-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
267-
self.grpc_channel
268-
)
274+
if self._operations_client is None:
275+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
269276

270277
# Return the client from cache.
271-
return self.__dict__["operations_client"]
278+
return self._operations_client
272279

273280
@property
274281
def create_dataset(

0 commit comments

Comments
 (0)