Skip to content

Instantly share code, notes, and snippets.

@athoune
Created November 10, 2014 20:14
Show Gist options
  • Save athoune/01a739ed722257e613e1 to your computer and use it in GitHub Desktop.
Save athoune/01a739ed722257e613e1 to your computer and use it in GitHub Desktop.
Sending Luigi failure to Sentry
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)
@stroykova
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment