Created
May 7, 2024 18:30
-
-
Save tuulos/fd165242020606fc73095ad2308503af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from metaflow import FlowSpec, step | |
from functools import wraps | |
def log_to_sentry(x): | |
print('sentry', x) | |
def sentry_logger(f): | |
@wraps(f) | |
def func(self): | |
try: | |
f(self) | |
except Exception as x: | |
log_to_sentry(x) | |
raise | |
return func | |
class SentryFlow(FlowSpec): | |
@sentry_logger | |
@step | |
def start(self): | |
raise KeyError('foobar') | |
self.next(self.end) | |
@step | |
def end(self): | |
pass | |
if __name__ == '__main__': | |
SentryFlow() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment