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

Celery Task throws option is ignored by receiver_task_failure signal. #62

Closed
meunomemauricio opened this issue Mar 22, 2021 · 1 comment · Fixed by #70
Closed

Celery Task throws option is ignored by receiver_task_failure signal. #62

meunomemauricio opened this issue Mar 22, 2021 · 1 comment · Fixed by #70

Comments

@meunomemauricio
Copy link

meunomemauricio commented Mar 22, 2021

In Celery, it's possible to specify a tuple of exceptions in the throws option. This allows us to mark a task as Failed but only log it as INFO, not ERROR.

This is how it's handled on Celery:

https://github.com/celery/celery/blob/1c955bf76a9a33052d87f2bccf0889fb21f27d41/celery/app/trace.py#L131-L141

https://github.com/celery/celery/blob/1c955bf76a9a33052d87f2bccf0889fb21f27d41/celery/app/trace.py#L233-L258

But this functionality is being ignored in the receiver_task_failure signal, which always log it as an exception:

def receiver_task_failure(
task_id=None, exception=None, traceback=None, einfo=None, *args, **kwargs
):
logger.exception("task_failed", error=str(exception), exception=exception)

I wonder if there's a way to work around this. I really like the throws functionality.

@jrobichaud
Copy link
Owner

jrobichaud commented Sep 29, 2021

Fixed in 2.1.3. Let me know if it does not suit your needs.

I did like in Celery's documentation: Log as info and no traceback.

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

Successfully merging a pull request may close this issue.

2 participants