问题描述
我试图了解如何以及何时清理芹菜任务。通过查看,我看到了:
I'm trying to understand how and when tasks are cleaned up in celery. From looking at the task docs I see that:
但是此引用来自RabbitMQ结果后端部分,并且在数据库后端部分中没有看到任何类似的文本。所以我的问题是:是否有可以使用芹菜清理旧任务的后端不可知方法,如果没有,我应该采取特定于数据库后端的方法吗?万一我使用django-celery有什么不同。谢谢。
But this quote is from the RabbitMQ Result Backend section and I do not see any similar text in the Database Backend section. So my question is: is there a backend agnostic approach I can take for old task clean-up with celery and if not is there a DB Backend specific approach I should take? Incase it makes any difference I'm using django-celery. Thanks.
推荐答案
如果单击指向CELERY_TASK_RESULT_EXPIRES的设置文档的链接:
If you click on the link to the setting doc for CELERY_TASK_RESULT_EXPIRES:
它确实说数据库支持此功能,但是您需要运行celery beat(
It does say that database supports this, but then you need to run celery beat (there's a default periodic task, called every day, to remove expired results).
任务中的后端文档也应该提及这一点,也许应该有专门的定期任务来删除过期的结果。后端指南。如果要为此进行游说,请在
The backend docs in the task should probably mention this as well, maybe there should be a dedicated guide for backends too. If you want to lobby for this, then please open up an issue at https://github.com/celery/celery/issues
这篇关于数据库后端清理芹菜任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!