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

Use Signals to capture exceptions (and update task status ) #92

Open
danleyb2 opened this issue Jan 24, 2022 · 0 comments
Open

Use Signals to capture exceptions (and update task status ) #92

danleyb2 opened this issue Jan 24, 2022 · 0 comments

Comments

@danleyb2
Copy link
Member

Example:

@task_failure.connect
def process_failure_signal(sender=None, task_id=None, exception=None,
        args=None, kwargs=None, traceback=None, einfo=None, **akwargs):
    # From https://groups.google.com/d/msg/celery-users/lb3_5aAFesA/E1R4TIUiAwgJ
    exc_info = (type(exception), exception, traceback)
    logger.error(
        'Celery job exception: %s (%s)' % (exception.__class__.__name__, exception),
        exc_info=exc_info,
        extra={
            'data': {
                'task_id': task_id,
                'sender': sender,
                'args': args,
                'kwargs': kwargs,
            }
        }
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant