from celery import Celery
from celery.signals import task_failure

from raven import Client

from waterbutler.settings import config
from waterbutler.tasks import settings as tasks_settings


app = Celery()
app.config_from_object(tasks_settings)


def register_signal(client):
    """Adapted from `raven.contrib.celery.register_signal`. Remove args and
    kwargs from logs so that keys aren't leaked to Sentry.
    """
    def process_failure_signal(sender, task_id, *args, **kwargs):
        client.captureException(
            extra={
                'task_id': task_id,
                'task': sender,
            }
        )
    task_failure.connect(process_failure_signal, weak=False)


sentry_dsn = config.get_nullable('SENTRY_DSN', None)
if sentry_dsn:
    client = Client(sentry_dsn)
    register_signal(client)
else:
    client = None

54011a886a8c4308427862c787a6f7302b2643d4
<mask token>


def register_signal(client):
    """Adapted from `raven.contrib.celery.register_signal`. Remove args and
    kwargs from logs so that keys aren't leaked to Sentry.
    """

    def process_failure_signal(sender, task_id, *args, **kwargs):
        client.captureException(extra={'task_id': task_id, 'task': sender})
    task_failure.connect(process_failure_signal, weak=False)


<mask token>

<mask token>
app.config_from_object(tasks_settings)


def register_signal(client):
    """Adapted from `raven.contrib.celery.register_signal`. Remove args and
    kwargs from logs so that keys aren't leaked to Sentry.
    """

    def process_failure_signal(sender, task_id, *args, **kwargs):
        client.captureException(extra={'task_id': task_id, 'task': sender})
    task_failure.connect(process_failure_signal, weak=False)


<mask token>
if sentry_dsn:
    client = Client(sentry_dsn)
    register_signal(client)
else:
    client = None

<mask token>
app = Celery()
app.config_from_object(tasks_settings)


def register_signal(client):
    """Adapted from `raven.contrib.celery.register_signal`. Remove args and
    kwargs from logs so that keys aren't leaked to Sentry.
    """

    def process_failure_signal(sender, task_id, *args, **kwargs):
        client.captureException(extra={'task_id': task_id, 'task': sender})
    task_failure.connect(process_failure_signal, weak=False)


sentry_dsn = config.get_nullable('SENTRY_DSN', None)
if sentry_dsn:
    client = Client(sentry_dsn)
    register_signal(client)
else:
    client = None

from celery import Celery
from celery.signals import task_failure
from raven import Client
from waterbutler.settings import config
from waterbutler.tasks import settings as tasks_settings
app = Celery()
app.config_from_object(tasks_settings)


def register_signal(client):
    """Adapted from `raven.contrib.celery.register_signal`. Remove args and
    kwargs from logs so that keys aren't leaked to Sentry.
    """

    def process_failure_signal(sender, task_id, *args, **kwargs):
        client.captureException(extra={'task_id': task_id, 'task': sender})
    task_failure.connect(process_failure_signal, weak=False)


sentry_dsn = config.get_nullable('SENTRY_DSN', None)
if sentry_dsn:
    client = Client(sentry_dsn)
    register_signal(client)
else:
    client = None

from celery import Celery
from celery.signals import task_failure

from raven import Client

from waterbutler.settings import config
from waterbutler.tasks import settings as tasks_settings


app = Celery()
app.config_from_object(tasks_settings)


def register_signal(client):
    """Adapted from `raven.contrib.celery.register_signal`. Remove args and
    kwargs from logs so that keys aren't leaked to Sentry.
    """
    def process_failure_signal(sender, task_id, *args, **kwargs):
        client.captureException(
            extra={
                'task_id': task_id,
                'task': sender,
            }
        )
    task_failure.connect(process_failure_signal, weak=False)


sentry_dsn = config.get_nullable('SENTRY_DSN', None)
if sentry_dsn:
    client = Client(sentry_dsn)
    register_signal(client)
else:
    client = None
