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

Commit

Permalink
fix: remove client recv msg limit fix: add enums to `types/__init__.p…
Browse files Browse the repository at this point in the history
…y` (#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>
  • Loading branch information
yoshi-automation and busunkim96 committed Dec 28, 2020
1 parent 7b0c965 commit 19e8f0c
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 15 deletions.
Expand Up @@ -30,7 +30,6 @@
_transport_registry["grpc"] = DataLabelingServiceGrpcTransport
_transport_registry["grpc_asyncio"] = DataLabelingServiceGrpcAsyncIOTransport


__all__ = (
"DataLabelingServiceTransport",
"DataLabelingServiceGrpcTransport",
Expand Down
Expand Up @@ -159,6 +159,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
self._ssl_channel_credentials = ssl_credentials
else:
Expand All @@ -177,9 +181,14 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)

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

# Run the base constructor.
super().__init__(
Expand All @@ -203,7 +212,7 @@ def create_channel(
) -> grpc.Channel:
"""Create and return a gRPC channel object.
Args:
address (Optionsl[str]): The host for the channel to use.
address (Optional[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
Expand Down Expand Up @@ -250,13 +259,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
client.
"""
# Sanity check: Only create a new client if we do not already have one.
if "operations_client" not in self.__dict__:
self.__dict__["operations_client"] = operations_v1.OperationsClient(
self.grpc_channel
)
if self._operations_client is None:
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)

# Return the client from cache.
return self.__dict__["operations_client"]
return self._operations_client

@property
def create_dataset(
Expand Down
Expand Up @@ -204,6 +204,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
self._ssl_channel_credentials = ssl_credentials
else:
Expand All @@ -222,6 +226,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)

# Run the base constructor.
Expand All @@ -235,6 +243,7 @@ def __init__(
)

self._stubs = {}
self._operations_client = None

@property
def grpc_channel(self) -> aio.Channel:
Expand All @@ -254,13 +263,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
client.
"""
# Sanity check: Only create a new client if we do not already have one.
if "operations_client" not in self.__dict__:
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
if self._operations_client is None:
self._operations_client = operations_v1.OperationsAsyncClient(
self.grpc_channel
)

# Return the client from cache.
return self.__dict__["operations_client"]
return self._operations_client

@property
def create_dataset(
Expand Down
11 changes: 10 additions & 1 deletion google/cloud/datalabeling_v1beta1/types/__init__.py
Expand Up @@ -42,6 +42,9 @@
VideoEventAnnotation,
AnnotationMetadata,
OperatorMetadata,
AnnotationSource,
AnnotationSentiment,
AnnotationType,
)
from .data_payloads import (
ImagePayload,
Expand All @@ -62,6 +65,7 @@
TextClassificationConfig,
SentimentConfig,
TextEntityExtractionConfig,
StringAggregationType,
)
from .dataset import (
Dataset,
Expand All @@ -78,6 +82,7 @@
LabelStats,
AnnotatedDatasetMetadata,
Example,
DataType,
)
from .evaluation import (
Evaluation,
Expand Down Expand Up @@ -166,7 +171,6 @@
CreateInstructionMetadata,
)


__all__ = (
"AnnotationSpecSet",
"AnnotationSpec",
Expand All @@ -192,6 +196,9 @@
"VideoEventAnnotation",
"AnnotationMetadata",
"OperatorMetadata",
"AnnotationSource",
"AnnotationSentiment",
"AnnotationType",
"ImagePayload",
"TextPayload",
"VideoThumbnail",
Expand All @@ -208,6 +215,7 @@
"TextClassificationConfig",
"SentimentConfig",
"TextEntityExtractionConfig",
"StringAggregationType",
"Dataset",
"InputConfig",
"TextMetadata",
Expand All @@ -222,6 +230,7 @@
"LabelStats",
"AnnotatedDatasetMetadata",
"Example",
"DataType",
"Evaluation",
"EvaluationConfig",
"BoundingBoxEvaluationOptions",
Expand Down
116 changes: 112 additions & 4 deletions synth.metadata
Expand Up @@ -3,16 +3,16 @@
{
"git": {
"name": ".",
"remote": "git@github.com:googleapis/python-datalabeling.git",
"sha": "3dac8e068118b5dea339653b0a731461c236c545"
"remote": "https://github.com/googleapis/python-datalabeling.git",
"sha": "3d643383e481fa22093756343bdf50eba002b1f8"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "5fdb685a684269e07c10c7518372eb5d7b6bc0a9",
"internalRef": "342906697"
"sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907",
"internalRef": "347055288"
}
},
{
Expand Down Expand Up @@ -40,5 +40,113 @@
"generator": "bazel"
}
}
],
"generatedFiles": [
".flake8",
".github/CONTRIBUTING.md",
".github/ISSUE_TEMPLATE/bug_report.md",
".github/ISSUE_TEMPLATE/feature_request.md",
".github/ISSUE_TEMPLATE/support_request.md",
".github/PULL_REQUEST_TEMPLATE.md",
".github/release-please.yml",
".github/snippet-bot.yml",
".gitignore",
".kokoro/build.sh",
".kokoro/continuous/common.cfg",
".kokoro/continuous/continuous.cfg",
".kokoro/docker/docs/Dockerfile",
".kokoro/docker/docs/fetch_gpg_keys.sh",
".kokoro/docs/common.cfg",
".kokoro/docs/docs-presubmit.cfg",
".kokoro/docs/docs.cfg",
".kokoro/populate-secrets.sh",
".kokoro/presubmit/common.cfg",
".kokoro/presubmit/presubmit.cfg",
".kokoro/publish-docs.sh",
".kokoro/release.sh",
".kokoro/release/common.cfg",
".kokoro/release/release.cfg",
".kokoro/samples/lint/common.cfg",
".kokoro/samples/lint/continuous.cfg",
".kokoro/samples/lint/periodic.cfg",
".kokoro/samples/lint/presubmit.cfg",
".kokoro/samples/python3.6/common.cfg",
".kokoro/samples/python3.6/continuous.cfg",
".kokoro/samples/python3.6/periodic.cfg",
".kokoro/samples/python3.6/presubmit.cfg",
".kokoro/samples/python3.7/common.cfg",
".kokoro/samples/python3.7/continuous.cfg",
".kokoro/samples/python3.7/periodic.cfg",
".kokoro/samples/python3.7/presubmit.cfg",
".kokoro/samples/python3.8/common.cfg",
".kokoro/samples/python3.8/continuous.cfg",
".kokoro/samples/python3.8/periodic.cfg",
".kokoro/samples/python3.8/presubmit.cfg",
".kokoro/test-samples.sh",
".kokoro/trampoline.sh",
".kokoro/trampoline_v2.sh",
".trampolinerc",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.rst",
"LICENSE",
"MANIFEST.in",
"docs/_static/custom.css",
"docs/_templates/layout.html",
"docs/conf.py",
"docs/datalabeling_v1beta1/services.rst",
"docs/datalabeling_v1beta1/types.rst",
"docs/multiprocessing.rst",
"google/cloud/datalabeling/__init__.py",
"google/cloud/datalabeling/py.typed",
"google/cloud/datalabeling_v1beta1/__init__.py",
"google/cloud/datalabeling_v1beta1/proto/annotation.proto",
"google/cloud/datalabeling_v1beta1/proto/annotation_spec_set.proto",
"google/cloud/datalabeling_v1beta1/proto/data_labeling_service.proto",
"google/cloud/datalabeling_v1beta1/proto/data_payloads.proto",
"google/cloud/datalabeling_v1beta1/proto/dataset.proto",
"google/cloud/datalabeling_v1beta1/proto/evaluation.proto",
"google/cloud/datalabeling_v1beta1/proto/evaluation_job.proto",
"google/cloud/datalabeling_v1beta1/proto/human_annotation_config.proto",
"google/cloud/datalabeling_v1beta1/proto/instruction.proto",
"google/cloud/datalabeling_v1beta1/proto/operations.proto",
"google/cloud/datalabeling_v1beta1/py.typed",
"google/cloud/datalabeling_v1beta1/services/__init__.py",
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/__init__.py",
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py",
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py",
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/pagers.py",
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/__init__.py",
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py",
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py",
"google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py",
"google/cloud/datalabeling_v1beta1/types/__init__.py",
"google/cloud/datalabeling_v1beta1/types/annotation.py",
"google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py",
"google/cloud/datalabeling_v1beta1/types/data_labeling_service.py",
"google/cloud/datalabeling_v1beta1/types/data_payloads.py",
"google/cloud/datalabeling_v1beta1/types/dataset.py",
"google/cloud/datalabeling_v1beta1/types/evaluation.py",
"google/cloud/datalabeling_v1beta1/types/evaluation_job.py",
"google/cloud/datalabeling_v1beta1/types/human_annotation_config.py",
"google/cloud/datalabeling_v1beta1/types/instruction.py",
"google/cloud/datalabeling_v1beta1/types/operations.py",
"mypy.ini",
"noxfile.py",
"renovate.json",
"samples/AUTHORING_GUIDE.md",
"samples/CONTRIBUTING.md",
"samples/snippets/noxfile.py",
"scripts/decrypt-secrets.sh",
"scripts/fixup_datalabeling_v1beta1_keywords.py",
"scripts/readme-gen/readme_gen.py",
"scripts/readme-gen/templates/README.tmpl.rst",
"scripts/readme-gen/templates/auth.tmpl.rst",
"scripts/readme-gen/templates/auth_api_key.tmpl.rst",
"scripts/readme-gen/templates/install_deps.tmpl.rst",
"scripts/readme-gen/templates/install_portaudio.tmpl.rst",
"setup.cfg",
"testing/.gitignore",
"tests/unit/gapic/datalabeling_v1beta1/__init__.py",
"tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py"
]
}
Expand Up @@ -9747,6 +9747,10 @@ def test_data_labeling_service_transport_channel_mtls_with_client_cert_source(
scopes=("https://www.googleapis.com/auth/cloud-platform",),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
assert transport.grpc_channel == mock_grpc_channel
assert transport._ssl_channel_credentials == mock_ssl_cred
Expand Down Expand Up @@ -9788,6 +9792,10 @@ def test_data_labeling_service_transport_channel_mtls_with_adc(transport_class):
scopes=("https://www.googleapis.com/auth/cloud-platform",),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
assert transport.grpc_channel == mock_grpc_channel

Expand Down

0 comments on commit 19e8f0c

Please sign in to comment.