数据库后端清理芹菜任务 [英] celery task clean-up with DB backend

查看:104
本文介绍了数据库后端清理芹菜任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解如何以及何时清理芹菜任务。通过查看任务文档,我看到了:

I'm trying to understand how and when tasks are cleaned up in celery. From looking at the task docs I see that:


旧结果将根据
CELERY_TASK_RESULT_EXPIRES设置自动清除。默认情况下,此值设置为1天后过期
:如果群集非常繁忙,则应降低
的值。

Old results will be cleaned automatically, based on the CELERY_TASK_RESULT_EXPIRES setting. By default this is set to expire after 1 day: if you have a very busy cluster you should lower this value.

但是此引用来自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:

http://docs.celeryproject.org /en/latest/userguide/configuration.html#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).

任务中的后端文档也应该提及这一点,也许应该有专门的定期任务来删除过期的结果。后端指南。如果要为此进行游说,请在 https://github.com/celery中打开一个问题/ celery / issues

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

这篇关于数据库后端清理芹菜任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆