芹菜文档告诉我,如果多个任务链接在一起,第一个任务的结果将是下一个任务的第一个参数。我的问题是,当我有一个返回多个结果的任务时,我无法让它工作。芹菜:多重参数链接任务
例:
@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
并得到两个结果。
想要解决“返回下一个功能的位置参数”问题的用户可能会对我的答案感兴趣http://stackoverflow.com/a/15778196/114917 –