Skip to content

Commit 80260b4

Browse files
author
Osmar Coronel
committed
Cleaned the integration
1 parent 5fbbe0f commit 80260b4

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ branches:
1818
only:
1919
- master
2020
- /^release\/.+$/
21-
- beam-integration
2221

2322
matrix:
2423
allow_failures:

sentry_sdk/integrations/beam.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def setup_once():
3030
setattr(
3131
DoFn,
3232
INSPECT_FUNC.format(func_name),
33-
patched_inspect_process(DoFn, func_name),
33+
_wrap_inspect_call(DoFn, func_name),
3434
)
3535

3636
old_init = ParDo.__init__
@@ -61,7 +61,7 @@ def sentry_init_pardo(self, fn, *args, **kwargs):
6161
ParDo.__init__ = sentry_init_pardo
6262

6363

64-
def patched_inspect_process(cls, func_name):
64+
def _wrap_inspect_call(cls, func_name):
6565
from apache_beam.typehints.decorators import getfullargspec # type: ignore
6666

6767
if not hasattr(cls, func_name):
@@ -108,7 +108,7 @@ def _inner(*args, **kwargs):
108108

109109
def _capture_exception(exc_info, hub):
110110
"""
111-
Send Beam exception to Sentry
111+
Send Beam exception to Sentry.
112112
"""
113113
integration = hub.get_integration(BeamIntegration)
114114
if integration:
@@ -142,6 +142,6 @@ def _wrap_generator_call(gen, client):
142142
try:
143143
yield next(gen)
144144
except StopIteration:
145-
raise
145+
break
146146
except Exception:
147147
raise_exception(client)

tests/integrations/beam/test_beam.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import pytest
2-
import dill
32
import inspect
43

54
pytest.importorskip("apache_beam")
65

6+
import dill
7+
78
from sentry_sdk.integrations.beam import (
89
BeamIntegration,
910
_wrap_task_call,
10-
patched_inspect_process,
11+
_wrap_inspect_call,
1112
)
1213

1314
from apache_beam.typehints.trivial_inference import instance_to_type
@@ -35,7 +36,7 @@ class A:
3536
def __init__(self, fn):
3637
self.r = "We are in A"
3738
self.fn = fn
38-
setattr(self, "_inspect_fn", patched_inspect_process(self, "fn"))
39+
setattr(self, "_inspect_fn", _wrap_inspect_call(self, "fn"))
3940

4041
def process(self):
4142
return self.fn()
@@ -153,8 +154,12 @@ def test_monkey_patch_signature(f, args, kwargs):
153154
class _OutputProcessor(OutputProcessor):
154155
def process_outputs(self, windowed_input_element, results):
155156
print(windowed_input_element)
156-
for result in results:
157-
assert result
157+
try:
158+
for result in results:
159+
assert result
160+
except StopIteration:
161+
print("In here")
162+
158163

159164

160165
@pytest.fixture

tox.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ envlist =
3232
{pypy,py2.7,py3.5,py3.6,py3.7,py3.8}-celery-{4.1,4.2,4.3}
3333
{pypy,py2.7}-celery-3
3434

35-
py2.7-beam-{12,13,master}
36-
{py3.6,py3.7,py3.8}-beam-{12,13,master,dev}
35+
{py2.7,py3.6}-beam-{12,13,master}
36+
py3.7-beam-{12,13}
3737

3838
# The aws_lambda tests deploy to the real AWS and have their own matrix of Python versions.
3939
py3.7-aws_lambda

0 commit comments

Comments
 (0)