我正在芹菜中启动一系列任务:
jobs = [some_task.delay(*arg) for arg in args]
results = jobs.get()
是否有某种方法可以连续输出从主线程或其他线程完成的任务数,即:
while tasks_still_running:
print "Completed %s of %s tasks." % (num_complete, len(jobs))
time.sleep(1)
您可以使用芹菜信号进行以下操作:
from celery.signals import task_success
@task_success.connect()
def tasks_success_callback(signal, result, sender):
print result