Skip to content

Commit bdd2d76

Browse files
resolve merge conflicts
1 parent 250cd79 commit bdd2d76

4 files changed

Lines changed: 21 additions & 59 deletions

File tree

packages/google-cloud-bigtable/google/cloud/bigtable/data/_async/_read_rows.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,15 @@
1515

1616
from __future__ import annotations
1717

18-
<<<<<<< HEAD
1918
import time
2019
from typing import TYPE_CHECKING, Sequence
2120

22-
from google.api_core import retry as retries
2321
from grpc import StatusCode
24-
=======
25-
from typing import Sequence, TYPE_CHECKING
26-
27-
from google.cloud.bigtable_v2.types import ReadRowsRequest as ReadRowsRequestPB
28-
from google.cloud.bigtable_v2.types import ReadRowsResponse as ReadRowsResponsePB
29-
from google.cloud.bigtable_v2.types import RowSet as RowSetPB
30-
from google.cloud.bigtable_v2.types import RowRange as RowRangePB
31-
32-
from google.cloud.bigtable.data.row import Row, Cell
33-
from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
34-
from google.cloud.bigtable.data.exceptions import InvalidChunk
35-
from google.cloud.bigtable.data.exceptions import _RowSetComplete
36-
from google.cloud.bigtable.data.exceptions import _ResetRow
37-
from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
38-
from google.cloud.bigtable.data._helpers import _retry_exception_factory
39-
from google.cloud.bigtable.data._helpers import _rst_stream_aware_predicate
40-
41-
from google.api_core.retry import exponential_sleep_generator
42-
>>>>>>> 3426dbfbca1 (feat: Added rst_stream exception handling for ReadRows. (#1298))
4322

4423
from google.cloud.bigtable.data._cross_sync import CrossSync
4524
from google.cloud.bigtable.data._helpers import (
4625
_attempt_timeout_generator,
26+
_rst_stream_aware_predicate,
4727
)
4828
from google.cloud.bigtable.data._metrics.tracked_retry import tracked_retry
4929
from google.cloud.bigtable.data.exceptions import (

packages/google-cloud-bigtable/google/cloud/bigtable/data/_helpers.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,22 @@
1717

1818
from __future__ import annotations
1919

20-
<<<<<<< HEAD
21-
=======
22-
from typing import Callable, Sequence, List, Tuple, TYPE_CHECKING, Union
23-
import time
24-
>>>>>>> 3426dbfbca1 (feat: Added rst_stream exception handling for ReadRows. (#1298))
2520
import enum
2621
import time
2722
from collections import namedtuple
28-
from typing import TYPE_CHECKING, List, Sequence, Tuple, Union
23+
from typing import (
24+
TYPE_CHECKING,
25+
Callable,
26+
List,
27+
Sequence,
28+
Tuple,
29+
Union,
30+
)
2931

3032
from google.api_core import exceptions as core_exceptions
31-
<<<<<<< HEAD
33+
from google.api_core import retry as retries
3234
from google.api_core.retry import RetryFailureReason, exponential_sleep_generator
3335

34-
=======
35-
from google.api_core import retry as retries
36-
from google.api_core.retry import RetryFailureReason
37-
>>>>>>> 3426dbfbca1 (feat: Added rst_stream exception handling for ReadRows. (#1298))
3836
from google.cloud.bigtable.data.exceptions import RetryExceptionGroup
3937
from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
4038

@@ -162,12 +160,14 @@ def _rst_stream_aware_predicate(
162160
"""
163161
# predicate to check for retryable error types
164162
if_exception_type = retries.if_exception_type(*exception_types)
163+
165164
# special case: treat InternalServerError with rst_stream error message as ServiceUnavailable
166-
rst_check = (
167-
lambda e: core_exceptions.ServiceUnavailable in exception_types
168-
and isinstance(e, core_exceptions.InternalServerError)
169-
and any(m in e.message.lower() for m in _RETRYABLE_INTERNAL_ERROR_MESSAGES)
170-
)
165+
def rst_check(e):
166+
return (
167+
core_exceptions.ServiceUnavailable in exception_types
168+
and isinstance(e, core_exceptions.InternalServerError)
169+
and any(m in e.message.lower() for m in _RETRYABLE_INTERNAL_ERROR_MESSAGES)
170+
)
171171

172172
return lambda e: if_exception_type(e) or rst_check(e)
173173

packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/_read_rows.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
import time
2222
from typing import TYPE_CHECKING, Sequence
2323

24-
from google.api_core import retry as retries
2524
from grpc import StatusCode
2625

2726
from google.cloud.bigtable.data._cross_sync import CrossSync
28-
from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
27+
from google.cloud.bigtable.data._helpers import (
28+
_attempt_timeout_generator,
29+
_rst_stream_aware_predicate,
30+
)
2931
from google.cloud.bigtable.data._metrics.tracked_retry import tracked_retry
3032
from google.cloud.bigtable.data.exceptions import (
3133
InvalidChunk,
@@ -37,20 +39,7 @@
3739
from google.cloud.bigtable_v2.types import ReadRowsRequest as ReadRowsRequestPB
3840
from google.cloud.bigtable_v2.types import ReadRowsResponse as ReadRowsResponsePB
3941
from google.cloud.bigtable_v2.types import RowRange as RowRangePB
40-
<<<<<<< HEAD
4142
from google.cloud.bigtable_v2.types import RowSet as RowSetPB
42-
=======
43-
from google.cloud.bigtable.data.row import Row, Cell
44-
from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
45-
from google.cloud.bigtable.data.exceptions import InvalidChunk
46-
from google.cloud.bigtable.data.exceptions import _RowSetComplete
47-
from google.cloud.bigtable.data.exceptions import _ResetRow
48-
from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
49-
from google.cloud.bigtable.data._helpers import _retry_exception_factory
50-
from google.cloud.bigtable.data._helpers import _rst_stream_aware_predicate
51-
from google.api_core.retry import exponential_sleep_generator
52-
from google.cloud.bigtable.data._cross_sync import CrossSync
53-
>>>>>>> 3426dbfbca1 (feat: Added rst_stream exception handling for ReadRows. (#1298))
5443

5544
if TYPE_CHECKING:
5645
from google.cloud.bigtable.data._metrics import ActiveOperationMetric

packages/google-cloud-bigtable/tests/unit/data/_async/test_client.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,6 @@ async def test_customizable_retryable_errors(
16371637
predicate_builder_mock.assert_called_once_with(
16381638
*expected_retryables, *extra_retryables
16391639
)
1640-
<<<<<<< HEAD
16411640
# output of if_exception_type should be sent in to retry constructor
16421641
retry_call_kwargs = retry_fn_mock.call_args_list[0].kwargs
16431642
# check for predicate passed as kwarg
@@ -1647,12 +1646,6 @@ async def test_customizable_retryable_errors(
16471646
# check for predicate passed as arg
16481647
retry_call_args = retry_fn_mock.call_args_list[0].args
16491648
assert retry_call_args[1] is expected_predicate
1650-
=======
1651-
retry_call_args = retry_fn_mock.call_args_list[0].args
1652-
1653-
# output of the predicate builder should be sent in to retry constructor
1654-
assert retry_call_args[1] is expected_predicate
1655-
>>>>>>> 3426dbfbca1 (feat: Added rst_stream exception handling for ReadRows. (#1298))
16561649

16571650
@pytest.mark.parametrize(
16581651
"fn_name,fn_args,gapic_fn",

0 commit comments

Comments
 (0)