Skip to content

Commit

Permalink
Merge pull request #1026 from nyaruka/log-celery-exceptions
Browse files Browse the repository at this point in the history
Log celery exceptions
  • Loading branch information
nicpottier committed Jan 16, 2017
2 parents de4c88c + 933bf64 commit 4d987d2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions temba/temba_celery.py
@@ -1,20 +1,28 @@
from __future__ import absolute_import, unicode_literals

import celery
import os
import raven
import sys
from celery import Celery

from django.conf import settings
from raven.contrib.celery import register_signal, register_logger_signal

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'temba.settings')

app = Celery('temba')
app = celery.Celery('temba')

# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

# register raven if configured
raven_config = getattr(settings, 'RAVEN_CONFIG', None)
if raven_config: # pragma: no cover
client = raven.Client(settings.RAVEN_CONFIG['dsn'])
register_logger_signal(client)
register_signal(client)


@app.task(bind=True)
def debug_task(self): # pragma: needs cover
Expand Down

0 comments on commit 4d987d2

Please sign in to comment.