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

Commit 19e8f0c

Browse files
fix: remove client recv msg limit fix: add enums to types/__init__.py (#62)
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 Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
1 parent 7b0c965 commit 19e8f0c

File tree

6 files changed

+155
-15
lines changed

6 files changed

+155
-15
lines changed

google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
_transport_registry["grpc"] = DataLabelingServiceGrpcTransport
3131
_transport_registry["grpc_asyncio"] = DataLabelingServiceGrpcAsyncIOTransport
3232

33-
3433
__all__ = (
3534
"DataLabelingServiceTransport",
3635
"DataLabelingServiceGrpcTransport",

google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ def __init__(
159159
ssl_credentials=ssl_credentials,
160160
scopes=scopes or self.AUTH_SCOPES,
161161
quota_project_id=quota_project_id,
162+
options=[
163+
("grpc.max_send_message_length", -1),
164+
("grpc.max_receive_message_length", -1),
165+
],
162166
)
163167
self._ssl_channel_credentials = ssl_credentials
164168
else:
@@ -177,9 +181,14 @@ def __init__(
177181
ssl_credentials=ssl_channel_credentials,
178182
scopes=scopes or self.AUTH_SCOPES,
179183
quota_project_id=quota_project_id,
184+
options=[
185+
("grpc.max_send_message_length", -1),
186+
("grpc.max_receive_message_length", -1),
187+
],
180188
)
181189

182190
self._stubs = {} # type: Dict[str, Callable]
191+
self._operations_client = None
183192

184193
# Run the base constructor.
185194
super().__init__(
@@ -203,7 +212,7 @@ def create_channel(
203212
) -> grpc.Channel:
204213
"""Create and return a gRPC channel object.
205214
Args:
206-
address (Optionsl[str]): The host for the channel to use.
215+
address (Optional[str]): The host for the channel to use.
207216
credentials (Optional[~.Credentials]): The
208217
authorization credentials to attach to requests. These
209218
credentials identify this application to the service. If
@@ -250,13 +259,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
250259
client.
251260
"""
252261
# Sanity check: Only create a new client if we do not already have one.
253-
if "operations_client" not in self.__dict__:
254-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
255-
self.grpc_channel
256-
)
262+
if self._operations_client is None:
263+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
257264

258265
# Return the client from cache.
259-
return self.__dict__["operations_client"]
266+
return self._operations_client
260267

261268
@property
262269
def create_dataset(

google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ def __init__(
204204
ssl_credentials=ssl_credentials,
205205
scopes=scopes or self.AUTH_SCOPES,
206206
quota_project_id=quota_project_id,
207+
options=[
208+
("grpc.max_send_message_length", -1),
209+
("grpc.max_receive_message_length", -1),
210+
],
207211
)
208212
self._ssl_channel_credentials = ssl_credentials
209213
else:
@@ -222,6 +226,10 @@ def __init__(
222226
ssl_credentials=ssl_channel_credentials,
223227
scopes=scopes or self.AUTH_SCOPES,
224228
quota_project_id=quota_project_id,
229+
options=[
230+
("grpc.max_send_message_length", -1),
231+
("grpc.max_receive_message_length", -1),
232+
],
225233
)
226234

227235
# Run the base constructor.
@@ -235,6 +243,7 @@ def __init__(
235243
)
236244

237245
self._stubs = {}
246+
self._operations_client = None
238247

239248
@property
240249
def grpc_channel(self) -> aio.Channel:
@@ -254,13 +263,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
254263
client.
255264
"""
256265
# Sanity check: Only create a new client if we do not already have one.
257-
if "operations_client" not in self.__dict__:
258-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
266+
if self._operations_client is None:
267+
self._operations_client = operations_v1.OperationsAsyncClient(
259268
self.grpc_channel
260269
)
261270

262271
# Return the client from cache.
263-
return self.__dict__["operations_client"]
272+
return self._operations_client
264273

265274
@property
266275
def create_dataset(

google/cloud/datalabeling_v1beta1/types/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
VideoEventAnnotation,
4343
AnnotationMetadata,
4444
OperatorMetadata,
45+
AnnotationSource,
46+
AnnotationSentiment,
47+
AnnotationType,
4548
)
4649
from .data_payloads import (
4750
ImagePayload,
@@ -62,6 +65,7 @@
6265
TextClassificationConfig,
6366
SentimentConfig,
6467
TextEntityExtractionConfig,
68+
StringAggregationType,
6569
)
6670
from .dataset import (
6771
Dataset,
@@ -78,6 +82,7 @@
7882
LabelStats,
7983
AnnotatedDatasetMetadata,
8084
Example,
85+
DataType,
8186
)
8287
from .evaluation import (
8388
Evaluation,
@@ -166,7 +171,6 @@
166171
CreateInstructionMetadata,
167172
)
168173

169-
170174
__all__ = (
171175
"AnnotationSpecSet",
172176
"AnnotationSpec",
@@ -192,6 +196,9 @@
192196
"VideoEventAnnotation",
193197
"AnnotationMetadata",
194198
"OperatorMetadata",
199+
"AnnotationSource",
200+
"AnnotationSentiment",
201+
"AnnotationType",
195202
"ImagePayload",
196203
"TextPayload",
197204
"VideoThumbnail",
@@ -208,6 +215,7 @@
208215
"TextClassificationConfig",
209216
"SentimentConfig",
210217
"TextEntityExtractionConfig",
218+
"StringAggregationType",
211219
"Dataset",
212220
"InputConfig",
213221
"TextMetadata",
@@ -222,6 +230,7 @@
222230
"LabelStats",
223231
"AnnotatedDatasetMetadata",
224232
"Example",
233+
"DataType",
225234
"Evaluation",
226235
"EvaluationConfig",
227236
"BoundingBoxEvaluationOptions",

synth.metadata

Lines changed: 112 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
{
44
"git": {
55
"name": ".",
6-
"remote": "git@github.com:googleapis/python-datalabeling.git",
7-
"sha": "3dac8e068118b5dea339653b0a731461c236c545"
6+
"remote": "https://github.com/googleapis/python-datalabeling.git",
7+
"sha": "3d643383e481fa22093756343bdf50eba002b1f8"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "5fdb685a684269e07c10c7518372eb5d7b6bc0a9",
15-
"internalRef": "342906697"
14+
"sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907",
15+
"internalRef": "347055288"
1616
}
1717
},
1818
{
@@ -40,5 +40,113 @@
4040
"generator": "bazel"
4141
}
4242
}
43+
],
44+
"generatedFiles": [
45+
".flake8",
46+
".github/CONTRIBUTING.md",
47+
".github/ISSUE_TEMPLATE/bug_report.md",
48+
".github/ISSUE_TEMPLATE/feature_request.md",
49+
".github/ISSUE_TEMPLATE/support_request.md",
50+
".github/PULL_REQUEST_TEMPLATE.md",
51+
".github/release-please.yml",
52+
".github/snippet-bot.yml",
53+
".gitignore",
54+
".kokoro/build.sh",
55+
".kokoro/continuous/common.cfg",
56+
".kokoro/continuous/continuous.cfg",
57+
".kokoro/docker/docs/Dockerfile",
58+
".kokoro/docker/docs/fetch_gpg_keys.sh",
59+
".kokoro/docs/common.cfg",
60+
".kokoro/docs/docs-presubmit.cfg",
61+
".kokoro/docs/docs.cfg",
62+
".kokoro/populate-secrets.sh",
63+
".kokoro/presubmit/common.cfg",
64+
".kokoro/presubmit/presubmit.cfg",
65+
".kokoro/publish-docs.sh",
66+
".kokoro/release.sh",
67+
".kokoro/release/common.cfg",
68+
".kokoro/release/release.cfg",
69+
".kokoro/samples/lint/common.cfg",
70+
".kokoro/samples/lint/continuous.cfg",
71+
".kokoro/samples/lint/periodic.cfg",
72+
".kokoro/samples/lint/presubmit.cfg",
73+
".kokoro/samples/python3.6/common.cfg",
74+
".kokoro/samples/python3.6/continuous.cfg",
75+
".kokoro/samples/python3.6/periodic.cfg",
76+
".kokoro/samples/python3.6/presubmit.cfg",
77+
".kokoro/samples/python3.7/common.cfg",
78+
".kokoro/samples/python3.7/continuous.cfg",
79+
".kokoro/samples/python3.7/periodic.cfg",
80+
".kokoro/samples/python3.7/presubmit.cfg",
81+
".kokoro/samples/python3.8/common.cfg",
82+
".kokoro/samples/python3.8/continuous.cfg",
83+
".kokoro/samples/python3.8/periodic.cfg",
84+
".kokoro/samples/python3.8/presubmit.cfg",
85+
".kokoro/test-samples.sh",
86+
".kokoro/trampoline.sh",
87+
".kokoro/trampoline_v2.sh",
88+
".trampolinerc",
89+
"CODE_OF_CONDUCT.md",
90+
"CONTRIBUTING.rst",
91+
"LICENSE",
92+
"MANIFEST.in",
93+
"docs/_static/custom.css",
94+
"docs/_templates/layout.html",
95+
"docs/conf.py",
96+
"docs/datalabeling_v1beta1/services.rst",
97+
"docs/datalabeling_v1beta1/types.rst",
98+
"docs/multiprocessing.rst",
99+
"google/cloud/datalabeling/__init__.py",
100+
"google/cloud/datalabeling/py.typed",
101+
"google/cloud/datalabeling_v1beta1/__init__.py",
102+
"google/cloud/datalabeling_v1beta1/proto/annotation.proto",
103+
"google/cloud/datalabeling_v1beta1/proto/annotation_spec_set.proto",
104+
"google/cloud/datalabeling_v1beta1/proto/data_labeling_service.proto",
105+
"google/cloud/datalabeling_v1beta1/proto/data_payloads.proto",
106+
"google/cloud/datalabeling_v1beta1/proto/dataset.proto",
107+
"google/cloud/datalabeling_v1beta1/proto/evaluation.proto",
108+
"google/cloud/datalabeling_v1beta1/proto/evaluation_job.proto",
109+
"google/cloud/datalabeling_v1beta1/proto/human_annotation_config.proto",
110+
"google/cloud/datalabeling_v1beta1/proto/instruction.proto",
111+
"google/cloud/datalabeling_v1beta1/proto/operations.proto",
112+
"google/cloud/datalabeling_v1beta1/py.typed",
113+
"google/cloud/datalabeling_v1beta1/services/__init__.py",
114+
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/__init__.py",
115+
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py",
116+
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py",
117+
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/pagers.py",
118+
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/__init__.py",
119+
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py",
120+
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py",
121+
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py",
122+
"google/cloud/datalabeling_v1beta1/types/__init__.py",
123+
"google/cloud/datalabeling_v1beta1/types/annotation.py",
124+
"google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py",
125+
"google/cloud/datalabeling_v1beta1/types/data_labeling_service.py",
126+
"google/cloud/datalabeling_v1beta1/types/data_payloads.py",
127+
"google/cloud/datalabeling_v1beta1/types/dataset.py",
128+
"google/cloud/datalabeling_v1beta1/types/evaluation.py",
129+
"google/cloud/datalabeling_v1beta1/types/evaluation_job.py",
130+
"google/cloud/datalabeling_v1beta1/types/human_annotation_config.py",
131+
"google/cloud/datalabeling_v1beta1/types/instruction.py",
132+
"google/cloud/datalabeling_v1beta1/types/operations.py",
133+
"mypy.ini",
134+
"noxfile.py",
135+
"renovate.json",
136+
"samples/AUTHORING_GUIDE.md",
137+
"samples/CONTRIBUTING.md",
138+
"samples/snippets/noxfile.py",
139+
"scripts/decrypt-secrets.sh",
140+
"scripts/fixup_datalabeling_v1beta1_keywords.py",
141+
"scripts/readme-gen/readme_gen.py",
142+
"scripts/readme-gen/templates/README.tmpl.rst",
143+
"scripts/readme-gen/templates/auth.tmpl.rst",
144+
"scripts/readme-gen/templates/auth_api_key.tmpl.rst",
145+
"scripts/readme-gen/templates/install_deps.tmpl.rst",
146+
"scripts/readme-gen/templates/install_portaudio.tmpl.rst",
147+
"setup.cfg",
148+
"testing/.gitignore",
149+
"tests/unit/gapic/datalabeling_v1beta1/__init__.py",
150+
"tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py"
43151
]
44152
}

tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9747,6 +9747,10 @@ def test_data_labeling_service_transport_channel_mtls_with_client_cert_source(
97479747
scopes=("https://www.googleapis.com/auth/cloud-platform",),
97489748
ssl_credentials=mock_ssl_cred,
97499749
quota_project_id=None,
9750+
options=[
9751+
("grpc.max_send_message_length", -1),
9752+
("grpc.max_receive_message_length", -1),
9753+
],
97509754
)
97519755
assert transport.grpc_channel == mock_grpc_channel
97529756
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -9788,6 +9792,10 @@ def test_data_labeling_service_transport_channel_mtls_with_adc(transport_class):
97889792
scopes=("https://www.googleapis.com/auth/cloud-platform",),
97899793
ssl_credentials=mock_ssl_cred,
97909794
quota_project_id=None,
9795+
options=[
9796+
("grpc.max_send_message_length", -1),
9797+
("grpc.max_receive_message_length", -1),
9798+
],
97919799
)
97929800
assert transport.grpc_channel == mock_grpc_channel
97939801

0 commit comments

Comments
 (0)