From 2d535dabd51ea101663d45d20b8fe125701a61d3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 14:48:13 +0000 Subject: [PATCH] feat: update grpc service config settings to reflect correct API deadlines (#82) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 392712211 Source-Link: https://github.com/googleapis/googleapis/commit/cb637a6db2a0e406d656055a286ad921134c7d57 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4c87ab9d52a5df08aa04dbfadaa01583fae5278b Release-As: 1.0.0 --- .../services/product_service/async_client.py | 12 +++++++- .../product_service/transports/base.py | 14 +++++++++- .../user_event_service/async_client.py | 24 ++++++++++++++-- .../user_event_service/transports/base.py | 28 +++++++++++++++++-- google/cloud/retail_v2/types/product.py | 5 +++- .../cloud/retail_v2/types/search_service.py | 25 ++++++++--------- 6 files changed, 87 insertions(+), 21 deletions(-) diff --git a/google/cloud/retail_v2/services/product_service/async_client.py b/google/cloud/retail_v2/services/product_service/async_client.py index dfb74841..288a418c 100644 --- a/google/cloud/retail_v2/services/product_service/async_client.py +++ b/google/cloud/retail_v2/services/product_service/async_client.py @@ -686,7 +686,17 @@ async def import_products( # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.import_products, - default_timeout=None, + default_retry=retries.Retry( + initial=0.1, + maximum=300.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=300.0, + ), + default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, ) diff --git a/google/cloud/retail_v2/services/product_service/transports/base.py b/google/cloud/retail_v2/services/product_service/transports/base.py index 75a390f2..ef92274e 100644 --- a/google/cloud/retail_v2/services/product_service/transports/base.py +++ b/google/cloud/retail_v2/services/product_service/transports/base.py @@ -174,7 +174,19 @@ def _prep_wrapped_messages(self, client_info): self.delete_product, default_timeout=None, client_info=client_info, ), self.import_products: gapic_v1.method.wrap_method( - self.import_products, default_timeout=None, client_info=client_info, + self.import_products, + default_retry=retries.Retry( + initial=0.1, + maximum=300.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=300.0, + ), + default_timeout=300.0, + client_info=client_info, ), self.set_inventory: gapic_v1.method.wrap_method( self.set_inventory, default_timeout=None, client_info=client_info, diff --git a/google/cloud/retail_v2/services/user_event_service/async_client.py b/google/cloud/retail_v2/services/user_event_service/async_client.py index 118181f8..beccce65 100644 --- a/google/cloud/retail_v2/services/user_event_service/async_client.py +++ b/google/cloud/retail_v2/services/user_event_service/async_client.py @@ -361,7 +361,17 @@ async def purge_user_events( # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.purge_user_events, - default_timeout=None, + default_retry=retries.Retry( + initial=0.1, + maximum=30.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=30.0, + ), + default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -429,7 +439,17 @@ async def import_user_events( # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.import_user_events, - default_timeout=None, + default_retry=retries.Retry( + initial=0.1, + maximum=300.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=300.0, + ), + default_timeout=300.0, client_info=DEFAULT_CLIENT_INFO, ) diff --git a/google/cloud/retail_v2/services/user_event_service/transports/base.py b/google/cloud/retail_v2/services/user_event_service/transports/base.py index 9a9aa852..7d820090 100644 --- a/google/cloud/retail_v2/services/user_event_service/transports/base.py +++ b/google/cloud/retail_v2/services/user_event_service/transports/base.py @@ -165,10 +165,34 @@ def _prep_wrapped_messages(self, client_info): self.collect_user_event, default_timeout=None, client_info=client_info, ), self.purge_user_events: gapic_v1.method.wrap_method( - self.purge_user_events, default_timeout=None, client_info=client_info, + self.purge_user_events, + default_retry=retries.Retry( + initial=0.1, + maximum=30.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=30.0, + ), + default_timeout=30.0, + client_info=client_info, ), self.import_user_events: gapic_v1.method.wrap_method( - self.import_user_events, default_timeout=None, client_info=client_info, + self.import_user_events, + default_retry=retries.Retry( + initial=0.1, + maximum=300.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=300.0, + ), + default_timeout=300.0, + client_info=client_info, ), self.rejoin_user_events: gapic_v1.method.wrap_method( self.rejoin_user_events, default_timeout=None, client_info=client_info, diff --git a/google/cloud/retail_v2/types/product.py b/google/cloud/retail_v2/types/product.py index dd2a65f3..dc5ddcd5 100644 --- a/google/cloud/retail_v2/types/product.py +++ b/google/cloud/retail_v2/types/product.py @@ -132,6 +132,9 @@ class Product(proto.Message): limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. + This field must be a Unigram. Otherwise, an INVALID_ARGUMENT + error is returned. + Google Merchant Center property `gtin `__. Schema.org property @@ -376,7 +379,7 @@ class Product(proto.Message): The pattern or graphic print of the product. For example, "striped", "polka dot", "paisley". - A maximum of 5 values are allowed per + A maximum of 20 values are allowed per [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is diff --git a/google/cloud/retail_v2/types/search_service.py b/google/cloud/retail_v2/types/search_service.py index a164cfdf..f617d497 100644 --- a/google/cloud/retail_v2/types/search_service.py +++ b/google/cloud/retail_v2/types/search_service.py @@ -94,8 +94,7 @@ class SearchRequest(proto.Message): The filter syntax consists of an expression language for constructing a predicate from one or more fields of the products being filtered. Filter expression is - case-sensitive. See more details at this `user - guide `__. + case-sensitive. If this field is unrecognizable, an INVALID_ARGUMENT is returned. @@ -117,8 +116,7 @@ class SearchRequest(proto.Message): ordered by a field in an [Product][google.cloud.retail.v2.Product] object. Leave it unset if ordered by relevance. OrderBy expression is - case-sensitive. See more details at this `user - guide `__. + case-sensitive. If this field is unrecognizable, an INVALID_ARGUMENT is returned. @@ -136,14 +134,12 @@ class SearchRequest(proto.Message): Contact Retail Search support team if you are interested in using dynamic facet feature. boost_spec (google.cloud.retail_v2.types.SearchRequest.BoostSpec): - Boost specification to boost certain products. See more - details at this `user - guide `__. + Boost specification to boost certain + products. query_expansion_spec (google.cloud.retail_v2.types.SearchRequest.QueryExpansionSpec): - The query expansion specification that specifies the - conditions under which query expansion will occur. See more - details at this `user - guide `__. + The query expansion specification that + specifies the conditions under which query + expansion will occur. variant_rollup_keys (Sequence[str]): The keys to fetch and rollup the matching [variant][google.cloud.retail.v2.Product.Type.VARIANT] @@ -501,9 +497,10 @@ class ConditionBoostSpec(proto.Message): Examples: - To boost products with product ID "product_1" or - "product_2", and color "Red" or "Blue": *(id: - ANY("product_1", "product_2"))* *AND* *(colorFamilies: - ANY("Red", "Blue"))* + "product_2", and color "Red" or "Blue": + + - (id: ANY("product_1", "product_2")) AND + (colorFamilies: ANY("Red","Blue")) boost (float): Strength of the condition boost, which should be in [-1, 1]. Negative boost means demotion. Default is 0.0.