问题:django celery.backend_cleanup的用法 [英] Question: Usage of django celery.backend_cleanup
问题描述
没有多少文档可用于 django celery.backend_cleanup
假设我有以下 4个以不同间隔安排的任务
检查DatabaseScheduler日志我发现只有 Task1
按间隔执行。
Checking DatabaseScheduler Logs I had found that only Task1
is executing on interval.
[2018-12-28 11:21:08,241: INFO/MainProcess] Writing entries...
[2018-12-28 11:24:08,778: INFO/MainProcess] Writing entries...
[2018-12-28 11:27:09,315: INFO/MainProcess] Writing entries...
[2018-12-28 11:28:32,948: INFO/MainProcess] Scheduler: Scheduler: Sending due TASK1(project_monitor_tasks)
[2018-12-28 11:30:13,215: INFO/MainProcess] Writing entries...
[2018-12-28 11:33:13,772: INFO/MainProcess] Writing entries...
[2018-12-28 11:36:14,316: INFO/MainProcess] Writing entries...
[2018-12-28 11:39:14,868: INFO/MainProcess] Writing entries...
[2018-12-28 11:42:15,397: INFO/MainProcess] Writing entries...
[2018-12-28 11:43:55,700: INFO/MainProcess] DatabaseScheduler: Schedule changed.
[2018-12-28 11:43:55,700: INFO/MainProcess] Writing entries...
[2018-12-28 11:45:15,997: INFO/MainProcess] Writing entries...
.....
....
[2018-12-28 17:16:28,613: INFO/MainProcess] Writing entries...
[2018-12-28 17:19:29,138: INFO/MainProcess] Writing entries...
[2018-12-28 17:22:29,625: INFO/MainProcess] Writing entries...
[2018-12-28 17:25:30,140: INFO/MainProcess] Writing entries...
[2018-12-28 17:28:30,657: INFO/MainProcess] Writing entries...
[2018-12-28 17:28:32,943: INFO/MainProcess] Scheduler: Sending due TASK1(project_monitor_tasks)
[2018-12-28 17:31:33,441: INFO/MainProcess] Writing entries...
[2018-12-28 17:34:34,009: INFO/MainProcess] Writing entries...
[2018-12-28 17:37:34,578: INFO/MainProcess] Writing entries...
[2018-12-28 17:40:35,130: INFO/MainProcess] Writing entries...
[2018-12-28 17:43:35,657: INFO/MainProcess] Writing entries...
[2018-12-28 17:43:50,716: INFO/MainProcess] DatabaseScheduler: Schedule changed.
[2018-12-28 17:43:50,716: INFO/MainProcess] Writing entries...
[2018-12-28 17:46:36,266: INFO/MainProcess] Writing entries...
[2018-12-28 17:49:36,809: INFO/MainProcess] Writing entries...
[2018-12-28 17:52:37,352: INFO/MainProcess] Writing entries...
Q1)为什么其他任务
位于不同的时间间隔,例如 24,8,10
小时没有执行? ,我假设这是因为 celery.backend_cleanup
的Crontab设置为每 4小时
正在清理队列中任务。我应该为 celery.backend_cleanup
任务保留较大的时间间隔吗?
Q1) why other TASKS
which are at different intervals such as 24,8,10
Hours are not executing? , I'm Assuming this is because Crontab of celery.backend_cleanup
is set to every 4 Hours
which is cleaning up queue tasks. Should i keep the large interval time for celery.backend_cleanup
task ?
Q2)为什么我们应保持 celery.backend_cleanup
任务?
Q2) Why we should keep celery.backend_cleanup
task? Does it loads new tasks on every cleanup?
推荐答案
问题1:我们无法在不了解实际时间表的情况下回答更多问题,知道您的芹菜的配置,或过去24小时的日志。 backend_cleanup
作业对代理没有影响,它的目的是通过从RDBMS celery结果后端删除过期结果来清除已过期的任务结果,因此它不会影响任务是否正确执行。
Q1: We can't answer more without seeing the actual schedules, knowing your configuration of celery, or the logs past twenty-four hours. The backend_cleanup
job has no effect on the broker, it's purpose is to clean up task results that have expired by deleting expired results from an RDBMS celery result backend, so it would have no effect on whether a task executes properly.
第二季度:请参见上文。如果您要使用RDBMS /数据库后端,并且要从芹菜结果后端数据库中删除过期的芹菜结果,则应使用此任务。
Q2: See above. You should use this task if you are using an RDBMS / database backend if you want your expired celery results to be deleted from your celery results backend database.
这篇关于问题:django celery.backend_cleanup的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!