Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log celery exceptions #1026

Merged
merged 4 commits into from Jan 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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