celery chain执行顺序错误?

我们有3个耗时任务, 需要串行执行, 前一个任务结果作为参数传给后一个任务.

刚好celery的chain可以支持这种需求, 于是我这样写:

chain(task1.s({'a':1}), task2.s(), task.s())
chain.apply_async()

但是实际上运行时, 三个任务的执行顺序是 task1--task3--task2

实在懵逼, 望大神解答~感激不尽!

I run a web server by tornado, and it woke up the tasks by chain.

logging: 
2018-07-23 18:34:12,816tid:140228657469056 DEBUG: chain: fetch({}) | callback() | convert() | format()

the other tasks run in celery

logging: 
[2018-07-23 18:34:12,816: INFO/MainProcess] Received task: fetch[045acf81-274b-457c-8bb5-6d0248264b76]
[2018-07-23 18:34:17,786: INFO/MainProcess] Received task: format[103b4ffa-57db-4b04-a745-7dfee5786695]
[2018-07-23 18:34:18,227: INFO/MainProcess] Received task: convert[81ddbaf9-37b3-406a-b608-a05affa97f45]
[2018-07-23 18:34:20,942: INFO/MainProcess] Received task: callback[b1ea7c70-db45-4501-9859-7ad22532c38a]


犯罪嫌疑人X
浏览 1272回答 2
2回答

蝴蝶不菲

原来是因为Celery在两台机器的版本不一致, 后面更改同版本后,运行正常
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python