Kevin Meyer
Kevin Meyer

Reputation: 2966

Can Celery email me if the task time limit is exceeded?

So I have a celery setup using RabbitMQ as the broker and amqp as the results backend.

Sometimes, I will have tasks that go long because I misunderestimated the needed timeout, and as intended, Celery will kill the worker running the task.

The problem is that because this is a celery problem and not a task problem, my error handling that's supposed to email me from the task will not run, and I will receive no message about the failure.

Is there a way to have Celery do some error notification on it's own when it kills a task due to Celery-related errors? Like an on_timeout() function that I can create in the task? I really don't want to have the calling process do the error handling, because the timeout is already a couple hours and the process runs for about 30 seconds.

Upvotes: 4

Views: 1052

Answers (1)

Akrasiac
Akrasiac

Reputation: 166

Looks like this question is from a while ago and you've probably resolved the issue, but in case not, have you checked out the CELERY_SEND_TASK_ERROR_EMAILS config setting?

Upvotes: 1

Related Questions