芹菜团体和连锁店 [英] Celery groups and chains

查看:26
本文介绍了芹菜团体和连锁店的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Celery中对一些任务进行排序,其中一些任务应作为单个任务,而某些则应并行工作,当组中的任务完成时,它应该通过下一个任务:

I need to sort some tasks in Celery that some of them should as a single task and some should work parallel and when the tasks in the group completed, it should pass the next one:

chain(
    task1.s(),
    task2.s(),
    group(task3.s(), task4.s()), 
    group(task5.s(), task6.s(), task7.s()), 
    task7.s()
).delay()

但是我认为我做错了.任何人都知道该怎么做吗?

But I think what did I do is wrong. Any body have idea how to do it?

此外,我不在乎将每个任务的结果发送给其他任务.

Also, I don't care about sending the result of each task to the others.

推荐答案

这个最终成功了:

chain(
    task1.s(),
    task2.s(),
    chord([task3.s(), task4.s()], body=task_result.s(), immutable=True), 
    chord([task5.s(), task6.s(), task7.s()], body=task_result.s(), immutable=True), 
    task7.s()
).delay()

这篇关于芹菜团体和连锁店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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