Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing Celery Task Results

I am pretty new to Celery and I thought I had read somewhere that the task results only stay around for a limited time. However my backend (redis) is getting pretty bloated after running a lot of tasks through it.

Is there a way to set a TTL on task results or is this something I need to manually purge (and how)?

like image 760
jwarzech Avatar asked Mar 13 '15 20:03

jwarzech


People also ask

How many tasks can Celery handle?

celery beats only trigger those 1000 tasks (by the crontab schedule), not run them. If you want to run 1000 tasks in parallel, you should have enough celery workers available to run those tasks.

How does Celery execute tasks?

Process of Task Execution by Celery can be broken down into:Your application sends the tasks to the task broker, it is then reserved by a worker for execution & finally the result of task execution is stored in the result backend.

What happens when a Celery task fails?

Celery will stop retrying after 7 failed attempts and raise an exception.


1 Answers

According to the celery documentation you can completely ignore all results using CELERY_IGNORE_RESULT.

You can also expire results after a set amount of time using CELERY_RESULT_EXPIRES, which defaults to 1 day. In the notes it says this should just work with the redis backend, whereas some of the other backends require celery beat to be running.

There is also the CELERY_MAX_CACHED_RESULTS setting that caches up to 5,000 results by default.

like image 166
Chris Ward Avatar answered Oct 06 '22 00:10

Chris Ward