本文介绍了跟踪celery.group任务的进度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
@celery.task
def my_task(my_object):
do_something_to_my_object(my_object)
#in the code somewhere
tasks = celery.group([my_task.s(obj) for obj in MyModel.objects.all()])
group_task = tasks.apply_async()
问题:芹菜有东西可以检测小组任务的进度吗?我可以得到那里有多少个任务以及已经处理了多少个任务的计数吗?
Question: Does celery have something to detect the progress of a group task? Can I get the count of how many tasks were there and how many have been processed?
推荐答案
在shell上进行修补(ipython的选项卡自动完成),我发现 group_task
(这是 celery.result.ResultSet
对象)的方法称为 completed_count
恰好满足了我的需求。
tinkering around on the shell (ipython's tab auto-completion) I found that group_task
(which is a celery.result.ResultSet
object) had a method called completed_count
which gave exactly what I needed.
还在
这篇关于跟踪celery.group任务的进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!