Created
November 10, 2014 20:14
-
-
Save athoune/01a739ed722257e613e1 to your computer and use it in GitHub Desktop.
Sending Luigi failure to Sentry
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
import os | |
import sys | |
import luigi | |
from raven import Client | |
client = Client() | |
# Define your Luigi tasks here | |
@luigi.Task.event_handler(luigi.Event.FAILURE) | |
def send_failure_to_sentry(task, exception): | |
client.captureException(exc_info=sys.exc_info(), | |
extra={ | |
"os_pid": os.getpid(), | |
"task": { | |
"id": task.task_id, | |
"family": task.task_family | |
}, | |
"param": { | |
"args": task.param_args, | |
"kwargs": task.param_kwargs | |
} | |
}, | |
culprit=task) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any ideas how to capture exception from hadoop map-reduce tasks?
I can use decorator for every mapper or reducer. I am looking for simpler way.