我們有3個耗時任務(wù), 需要串行執(zhí)行, 前一個任務(wù)結(jié)果作為參數(shù)傳給后一個任務(wù).剛好celery的chain可以支持這種需求, 于是我這樣寫:chain(task1.s({'a':1}), task2.s(), task.s())
chain.apply_async()但是實際上運行時, 三個任務(wù)的執(zhí)行順序是 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 celerylogging: [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]
添加回答
舉報
0/150
提交
取消