Skip to content

fix: Beam Integration Tests #500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 13, 2019
Merged

fix: Beam Integration Tests #500

merged 3 commits into from
Sep 13, 2019

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Sep 12, 2019

https://getsentry.atlassian.net/browse/SFD-14

This patch fixes the previously disabled beam tests. Running the tests with beam v2.12 and v2.13 was seen to be fine, the tests were experiencing issues with beam-master.

tests/integrations/beam/test_beam.py:182: in test_invoker_normal
    invoker = init_beam(fn)
tests/integrations/beam/test_beam.py:169: in inner
    pardo = ParDo(fn)
sentry_sdk/integrations/beam.py:60: in sentry_init_pardo
    old_init(self, fn, *args, **kwargs)
.tox/py3.7-beam-master/lib/python3.7/site-packages/apache_beam/transforms/core.py:1117: in __init__
    self._signature = DoFnSignature(self.fn)
.tox/py3.7-beam-master/lib/python3.7/site-packages/apache_beam/runners/common.py:232: in __init__
    self.process_method = MethodWrapper(do_fn, 'process')
.tox/py3.7-beam-master/lib/python3.7/site-packages/apache_beam/runners/common.py:157: in __init__
    method_name)
.tox/py3.7-beam-master/lib/python3.7/site-packages/apache_beam/transforms/core.py:305: in get_function_arguments
    return f()
sentry_sdk/integrations/beam.py:82: in _inspect
    return getfullargspec(process_func)
.tox/py3.7-beam-master/lib/python3.7/site-packages/apache_beam/typehints/decorators.py:135: in getfullargspec
    assert sys.version_info < (3,), 'This method should not be used in Python 3'
E   AssertionError: This method should not be used in Python 3

This is caused by apache/beam@b7cb0a1

TL;DR:

Migrate (almost fully) from using get(full)argspec and getcallargs to
inspect.signature. This simplifies code in some areas, such as: no more
handling of argspecs, no need to figure out if a function is a bound
method, and Signature and Parameter are nicer data structures.

I went through some debugging, more details to be found here: https://www.notion.so/sentry/SFD-14-bd6a2a669571416e90905b51971ac8db

To fix this, I now use get_function_args_defaults if possible, otherwise fallback to using getfullargspec like before.

Add conditional check to use get_function_args_defaults instead of getfullargspec if available
@AbhiPrasad AbhiPrasad marked this pull request as ready for review September 12, 2019 20:55
Copy link

@mikeclarke mikeclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me, ideally we can simplify our integration to drop support for these older versions once beam tags the next release

@untitaker untitaker merged commit cce401d into master Sep 13, 2019
@untitaker
Copy link
Member

Awesome, thanks!

@untitaker untitaker deleted the abhi/beam-test-fix branch September 13, 2019 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants