python - Celery是否使用链和组组合的结果后端?

标签 python celery

在我的 python 项目中,我想使用 celery 来创建任务管道:一些任务将被分组,并且该组是链的一部分。管道架构:

 task_chain = chain(
    group(
        chain(taks1.s(uid=uid, index=i), task2.s(uid=uid, index=i)) for i in
        range(len(collection))
    ),
    task3.s(uid=uid),
    task4.s(uid=uid),
    reduce_job_results_from_pages.s(job_uid=job_uid),
    push_metrics.s(job_uid=job_uid))

在这种情况下我应该使用结果后端还是仅代理就足够了? 我不明白 celery 使用什么技术来同步任务结果并将前一个任务或一组任务的结果传递到链中的下一个任务。

谢谢!

最佳答案

Important Notes 中提供了一些答案。 Canvas 页面上的部分:

Tasks used within a chord must not ignore their results. In practice this means that you must enable a result_backend in order to use chords. Additionally, if task_ignore_result is set to True in your configuration, be sure that the individual tasks to be used within the chord are defined with ignore_result=False. This applies to both Task subclasses and decorated tasks.

您可能想知道没有它是否可以摆脱困境,因为您不使用 Chord。 - 我相信 Celery 会将任何带有组的链转变为和弦。

关于python - Celery是否使用链和组组合的结果后端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62001024/

相关文章:

python - 为什么我的链返回的参数没有部分应用于下一个任务?

python - 在 Celery 中检索队列中的任务列表

python - 为什么 Celery 不将时间戳嵌入到排队消息中?

python - Python Opencv drawContour错误

python - OpenERP : fetch record with same name

linux - 无法连接到节点 rabbit@localhost : nodedown

django - 与 Django/Celery 和 CloudAMQP/Heroku 的连接错误

python - 为什么 pytesseract 不能处理 OSD 模式?

python - PyBrain 训练多输出模块

python - Pylint E1103 误报?