セロリのドキュメントによると、複数のタスクがチェーンされている場合、最初のタスクの結果が次の最初の引数になることがわかります。私の問題は、複数の結果を返すタスクがある場合、それを機能させることができないことです。
例:
@task()
def get_comments(url):
#get the comments and the submission and return them as 2 objects
return comments, submission
@task
def render_template(threadComments, submission):
#render the objects into a html file
#does not return anything
ここで、それらを (get_comments(url) | render_template()).apply_asnc() のようなチェーンで呼び出すと、python はTypeError: render_template() takes exactly 2 arguments (0 given)
.
結果がアンラップされておらず、引数に適用されていないことがわかります。get_comments だけを呼び出すと、次のことができます。
result = get_comments(url)
arg1, arg2 = result
両方の結果を取得します。