Skip to content

Commit

Permalink
fix: use retry_async instead of retry in async client (#713)
Browse files Browse the repository at this point in the history
* chore: Update gapic-generator-python to v1.12.0

PiperOrigin-RevId: 586356061

Source-Link: googleapis/googleapis@72a1f55

Source-Link: googleapis/googleapis-gen@558a04b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU4YTA0YmNkMWNjMDU3NmU4ZmFjMTA4OWU0OGU0OGIyN2FjMTYxYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: added Generator API
docs: updated doc for speech mode

PiperOrigin-RevId: 586469693

Source-Link: googleapis/googleapis@e8148d6

Source-Link: googleapis/googleapis-gen@85136bd
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODUxMzZiZDA0MzgzZWQ3MTcyYmIxOGI3YjhkMjIwZGQ3ZmY2YjNhMCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Lingqing Gan <lingqing.gan@gmail.com>
  • Loading branch information
3 people authored Dec 8, 2023
1 parent 4ab9b95 commit 4e18437
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
from google.api_core.client_options import ClientOptions
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import retry_async as retries
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore

from google.cloud.bigquery_storage_v1.types import arrow
from google.cloud.bigquery_storage_v1.types import avro
Expand Down Expand Up @@ -315,7 +315,7 @@ async def sample_create_read_session():
This corresponds to the ``max_stream_count`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -350,7 +350,7 @@ async def sample_create_read_session():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.create_read_session,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down Expand Up @@ -447,7 +447,7 @@ async def sample_read_rows():
This corresponds to the ``offset`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -482,7 +482,7 @@ async def sample_read_rows():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.read_rows,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down Expand Up @@ -565,7 +565,7 @@ async def sample_split_read_stream():
Args:
request (Optional[Union[google.cloud.bigquery_storage_v1.types.SplitReadStreamRequest, dict]]):
The request object. Request message for ``SplitReadStream``.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand All @@ -582,7 +582,7 @@ async def sample_split_read_stream():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.split_read_stream,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
from google.api_core.client_options import ClientOptions
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import retry_async as retries
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore

from google.cloud.bigquery_storage_v1.types import storage
from google.cloud.bigquery_storage_v1.types import stream
Expand Down Expand Up @@ -288,7 +288,7 @@ async def sample_create_write_stream():
This corresponds to the ``write_stream`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -324,7 +324,7 @@ async def sample_create_write_stream():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.create_write_stream,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=10.0,
maximum=120.0,
multiplier=1.3,
Expand Down Expand Up @@ -449,7 +449,7 @@ def request_generator():
The size of a single AppendRowsRequest must be less than
10 MB in size. Requests larger than this return an
error, typically ``INVALID_ARGUMENT``.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand All @@ -464,7 +464,7 @@ def request_generator():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.append_rows,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down Expand Up @@ -539,7 +539,7 @@ async def sample_get_write_stream():
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -573,7 +573,7 @@ async def sample_get_write_stream():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.get_write_stream,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down Expand Up @@ -653,7 +653,7 @@ async def sample_finalize_write_stream():
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -684,7 +684,7 @@ async def sample_finalize_write_stream():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.finalize_write_stream,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down Expand Up @@ -770,7 +770,7 @@ async def sample_batch_commit_write_streams():
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -801,7 +801,7 @@ async def sample_batch_commit_write_streams():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.batch_commit_write_streams,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down Expand Up @@ -889,7 +889,7 @@ async def sample_flush_rows():
This corresponds to the ``write_stream`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -920,7 +920,7 @@ async def sample_flush_rows():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.flush_rows,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
from google.api_core.client_options import ClientOptions
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import retry_async as retries
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore

from google.cloud.bigquery_storage_v1beta2.types import arrow
from google.cloud.bigquery_storage_v1beta2.types import avro
Expand Down Expand Up @@ -319,7 +319,7 @@ async def sample_create_read_session():
This corresponds to the ``max_stream_count`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -354,7 +354,7 @@ async def sample_create_read_session():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.create_read_session,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down Expand Up @@ -451,7 +451,7 @@ async def sample_read_rows():
This corresponds to the ``offset`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -486,7 +486,7 @@ async def sample_read_rows():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.read_rows,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down Expand Up @@ -569,7 +569,7 @@ async def sample_split_read_stream():
Args:
request (Optional[Union[google.cloud.bigquery_storage_v1beta2.types.SplitReadStreamRequest, dict]]):
The request object. Request message for ``SplitReadStream``.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand All @@ -586,7 +586,7 @@ async def sample_split_read_stream():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.split_read_stream,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
Expand Down
Loading

0 comments on commit 4e18437

Please sign in to comment.