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

Commit

Permalink
fix: remove gRPC send/recv limits; add enums to types/__init__.py (#…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
yoshi-automation and busunkim96 committed Dec 28, 2020
1 parent ca2b8f1 commit 4a2e2cf
Show file tree
Hide file tree
Showing 20 changed files with 143 additions and 47 deletions.
Expand Up @@ -28,7 +28,6 @@
_transport_registry["grpc"] = AutoMlGrpcTransport
_transport_registry["grpc_asyncio"] = AutoMlGrpcAsyncIOTransport


__all__ = (
"AutoMlTransport",
"AutoMlGrpcTransport",
Expand Down
19 changes: 13 additions & 6 deletions google/cloud/automl_v1/services/auto_ml/transports/grpc.py
Expand Up @@ -168,6 +168,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 @@ -186,9 +190,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 @@ -212,7 +221,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 @@ -259,13 +268,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
15 changes: 12 additions & 3 deletions google/cloud/automl_v1/services/auto_ml/transports/grpc_asyncio.py
Expand Up @@ -213,6 +213,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 @@ -231,6 +235,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 @@ -244,6 +252,7 @@ def __init__(
)

self._stubs = {}
self._operations_client = None

@property
def grpc_channel(self) -> aio.Channel:
Expand All @@ -263,13 +272,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
Expand Up @@ -28,7 +28,6 @@
_transport_registry["grpc"] = PredictionServiceGrpcTransport
_transport_registry["grpc_asyncio"] = PredictionServiceGrpcAsyncIOTransport


__all__ = (
"PredictionServiceTransport",
"PredictionServiceGrpcTransport",
Expand Down
Expand Up @@ -151,6 +151,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 @@ -169,9 +173,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 @@ -195,7 +204,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 @@ -242,13 +251,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 predict(
Expand Down
Expand Up @@ -196,6 +196,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 @@ -214,6 +218,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 @@ -227,6 +235,7 @@ def __init__(
)

self._stubs = {}
self._operations_client = None

@property
def grpc_channel(self) -> aio.Channel:
Expand All @@ -246,13 +255,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 predict(
Expand Down
3 changes: 2 additions & 1 deletion google/cloud/automl_v1/types/__init__.py
Expand Up @@ -18,6 +18,7 @@
from .classification import (
ClassificationAnnotation,
ClassificationEvaluationMetrics,
ClassificationType,
)
from .geometry import (
NormalizedVertex,
Expand Down Expand Up @@ -123,10 +124,10 @@
ListModelEvaluationsResponse,
)


__all__ = (
"ClassificationAnnotation",
"ClassificationEvaluationMetrics",
"ClassificationType",
"NormalizedVertex",
"BoundingPoly",
"ImageObjectDetectionAnnotation",
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/automl_v1beta1/__init__.py
Expand Up @@ -149,7 +149,6 @@
"AnnotationPayload",
"AnnotationSpec",
"ArrayStats",
"AutoMlClient",
"BatchPredictInputConfig",
"BatchPredictOperationMetadata",
"BatchPredictOutputConfig",
Expand Down Expand Up @@ -228,6 +227,7 @@
"OutputConfig",
"PredictRequest",
"PredictResponse",
"PredictionServiceClient",
"RegressionEvaluationMetrics",
"Row",
"StringStats",
Expand Down Expand Up @@ -269,5 +269,5 @@
"VideoObjectTrackingDatasetMetadata",
"VideoObjectTrackingEvaluationMetrics",
"VideoObjectTrackingModelMetadata",
"PredictionServiceClient",
"AutoMlClient",
)
Expand Up @@ -28,7 +28,6 @@
_transport_registry["grpc"] = AutoMlGrpcTransport
_transport_registry["grpc_asyncio"] = AutoMlGrpcAsyncIOTransport


__all__ = (
"AutoMlTransport",
"AutoMlGrpcTransport",
Expand Down
19 changes: 13 additions & 6 deletions google/cloud/automl_v1beta1/services/auto_ml/transports/grpc.py
Expand Up @@ -171,6 +171,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 @@ -189,9 +193,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 @@ -215,7 +224,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 @@ -262,13 +271,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 @@ -216,6 +216,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 @@ -234,6 +238,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 @@ -247,6 +255,7 @@ def __init__(
)

self._stubs = {}
self._operations_client = None

@property
def grpc_channel(self) -> aio.Channel:
Expand All @@ -266,13 +275,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
Expand Up @@ -28,7 +28,6 @@
_transport_registry["grpc"] = PredictionServiceGrpcTransport
_transport_registry["grpc_asyncio"] = PredictionServiceGrpcAsyncIOTransport


__all__ = (
"PredictionServiceTransport",
"PredictionServiceGrpcTransport",
Expand Down

0 comments on commit 4a2e2cf

Please sign in to comment.