Skip to content

Commit c433f3c

Browse files
committed
fixed lint
1 parent 144d75e commit c433f3c

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

google/cloud/bigtable/data/_async/metrics_interceptor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ async def _streaming_generator_wrapper(call):
7575
yield response
7676
except Exception as e:
7777
# handle errors while processing stream
78-
raise
78+
raise e

google/cloud/bigtable/data/_sync_autogen/metrics_interceptor.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,33 @@ class BigtableMetricsInterceptor(
2727
"""
2828

2929
def intercept_unary_unary(self, continuation, client_call_details, request):
30+
"""Interceptor for unary rpcs:
31+
- MutateRow
32+
- CheckAndMutateRow
33+
- ReadModifyWriteRow"""
3034
try:
3135
call = continuation(client_call_details, request)
3236
return call
3337
except Exception as rpc_error:
3438
raise rpc_error
3539

3640
def intercept_unary_stream(self, continuation, client_call_details, request):
37-
def response_wrapper(call):
38-
try:
39-
for response in call:
40-
yield response
41-
except Exception as e:
42-
raise e
43-
41+
"""Interceptor for streaming rpcs:
42+
- ReadRows
43+
- MutateRows
44+
- SampleRowKeys"""
4445
try:
45-
return response_wrapper(continuation(client_call_details, request))
46+
return self._streaming_generator_wrapper(
47+
continuation(client_call_details, request)
48+
)
4649
except Exception as rpc_error:
4750
raise rpc_error
51+
52+
@staticmethod
53+
def _streaming_generator_wrapper(call):
54+
"""Wrapped generator to be returned by intercept_unary_stream"""
55+
try:
56+
for response in call:
57+
yield response
58+
except Exception as e:
59+
raise e

0 commit comments

Comments
 (0)