Skip to content

Commit 19f323e

Browse files
authored
Fix: Implement Async Client to use Async Retry to work as expected (#1823)
Co-authored-by: omair <omairn@google.com>
1 parent 331a608 commit 19f323e

File tree

10 files changed

+194
-194
lines changed

10 files changed

+194
-194
lines changed

packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_async_mixins.py.j2

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
request (:class:`~.operations_pb2.ListOperationsRequest`):
1818
The request object. Request message for
1919
`ListOperations` method.
20-
retry (google.api_core.retry.Retry): Designation of what errors,
20+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
2121
if any, should be retried.
2222
timeout (float): The timeout for this request.
2323
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -71,7 +71,7 @@
7171
request (:class:`~.operations_pb2.GetOperationRequest`):
7272
The request object. Request message for
7373
`GetOperation` method.
74-
retry (google.api_core.retry.Retry): Designation of what errors,
74+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
7575
if any, should be retried.
7676
timeout (float): The timeout for this request.
7777
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -129,7 +129,7 @@
129129
request (:class:`~.operations_pb2.DeleteOperationRequest`):
130130
The request object. Request message for
131131
`DeleteOperation` method.
132-
retry (google.api_core.retry.Retry): Designation of what errors,
132+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
133133
if any, should be retried.
134134
timeout (float): The timeout for this request.
135135
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -181,7 +181,7 @@
181181
request (:class:`~.operations_pb2.CancelOperationRequest`):
182182
The request object. Request message for
183183
`CancelOperation` method.
184-
retry (google.api_core.retry.Retry): Designation of what errors,
184+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
185185
if any, should be retried.
186186
timeout (float): The timeout for this request.
187187
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -235,7 +235,7 @@
235235
request (:class:`~.operations_pb2.WaitOperationRequest`):
236236
The request object. Request message for
237237
`WaitOperation` method.
238-
retry (google.api_core.retry.Retry): Designation of what errors,
238+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
239239
if any, should be retried.
240240
timeout (float): The timeout for this request.
241241
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -295,7 +295,7 @@
295295
request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
296296
The request object. Request message for `SetIamPolicy`
297297
method.
298-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
298+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
299299
should be retried.
300300
timeout (float): The timeout for this request.
301301
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -415,7 +415,7 @@
415415
request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
416416
The request object. Request message for `GetIamPolicy`
417417
method.
418-
retry (google.api_core.retry.Retry): Designation of what errors, if
418+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if
419419
any, should be retried.
420420
timeout (float): The timeout for this request.
421421
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -536,7 +536,7 @@
536536
request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
537537
The request object. Request message for
538538
`TestIamPermissions` method.
539-
retry (google.api_core.retry.Retry): Designation of what errors,
539+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
540540
if any, should be retried.
541541
timeout (float): The timeout for this request.
542542
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -594,7 +594,7 @@
594594
request (:class:`~.location_pb2.GetLocationRequest`):
595595
The request object. Request message for
596596
`GetLocation` method.
597-
retry (google.api_core.retry.Retry): Designation of what errors,
597+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
598598
if any, should be retried.
599599
timeout (float): The timeout for this request.
600600
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -647,7 +647,7 @@
647647
request (:class:`~.location_pb2.ListLocationsRequest`):
648648
The request object. Request message for
649649
`ListLocations` method.
650-
retry (google.api_core.retry.Retry): Designation of what errors,
650+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
651651
if any, should be retried.
652652
timeout (float): The timeout for this request.
653653
metadata (Sequence[Tuple[str, str]]): Strings which should be

packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ from {{package_path}} import gapic_version as package_version
1616
from google.api_core.client_options import ClientOptions
1717
from google.api_core import exceptions as core_exceptions
1818
from google.api_core import gapic_v1
19-
from google.api_core import retry as retries
19+
from google.api_core import retry_async as retries
2020
from google.auth import credentials as ga_credentials # type: ignore
2121
from google.oauth2 import service_account # type: ignore
2222

2323
try:
24-
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
24+
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
2525
except AttributeError: # pragma: NO COVER
26-
OptionalRetry = Union[retries.Retry, object] # type: ignore
26+
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore
2727

2828
{% filter sort_lines %}
2929
{% for method in service.methods.values() %}
@@ -241,7 +241,7 @@ class {{ service.async_client_name }}:
241241
The request object AsyncIterator.{{ " " }}
242242
{{- method.input.meta.doc|rst(width=72, indent=16, nl=False) }}
243243
{% endif %}
244-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
244+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
245245
should be retried.
246246
timeout (float): The timeout for this request.
247247
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -313,7 +313,7 @@ class {{ service.async_client_name }}:
313313
rpc = gapic_v1.method_async.wrap_method(
314314
self._client._transport.{{ method.transport_safe_name|snake_case }},
315315
{% if method.retry %}
316-
default_retry=retries.Retry(
316+
default_retry=retries.AsyncRetry(
317317
{% if method.retry.initial_backoff %}initial={{ method.retry.initial_backoff }},{% endif %}
318318
{% if method.retry.max_backoff %}maximum={{ method.retry.max_backoff }},{% endif %}
319319
{% if method.retry.backoff_multiplier %}multiplier={{ method.retry.backoff_multiplier }},{% endif %}
@@ -403,7 +403,7 @@ class {{ service.async_client_name }}:
403403
request (:class:`~.policy_pb2.SetIamPolicyRequest`):
404404
The request object. Request message for `SetIamPolicy`
405405
method.
406-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
406+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
407407
should be retried.
408408
timeout (float): The timeout for this request.
409409
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -518,7 +518,7 @@ class {{ service.async_client_name }}:
518518
request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
519519
The request object. Request message for `GetIamPolicy`
520520
method.
521-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
521+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
522522
should be retried.
523523
timeout (float): The timeout for this request.
524524
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -635,7 +635,7 @@ class {{ service.async_client_name }}:
635635
request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
636636
The request object. Request message for
637637
`TestIamPermissions` method.
638-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
638+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
639639
should be retried.
640640
timeout (float): The timeout for this request.
641641
metadata (Sequence[Tuple[str, str]]): Strings which should be

0 commit comments

Comments
 (0)