Skip to content

Commit

Permalink
Log the traceback if a task fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaeon committed Feb 11, 2015
1 parent 3f1dad0 commit 30f4f2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/vpoller/task/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from functools import wraps
from traceback import format_exc

from vpoller.log import logger
from vpoller.task.core import Task
from vpoller.task.registry import registry

Expand All @@ -52,11 +53,13 @@ def wrapper(*args, **kwargs):
try:
result = fn(*args, **kwargs)
except Exception as e:
tb = format_exc()
result = {
'success': 1,
'msg': 'Task {} failed'.format(name),
'traceback': format_exc()
'traceback': tb
}
logger.warning('Task %s failed: %s', name, tb)
finally:
return result
t = Task(name=name, function=wrapper, required=required)
Expand Down

0 comments on commit 30f4f2c

Please sign in to comment.