https://code.google.com/p/appengine-pipeline/wiki/GettingStarted#Execution_ordering
我试图添加一个回调函数,在Log2Bq完成后执行。
但不管我用pipeline.After
还是pipeline.InOrder
,它都不起作用。在下面的代码示例中,taskqueue将立即执行,而不需要等待Log2Bq。为了解决这个问题,
我是否需要创建另一个管道来保存taskqueue以使执行顺序正常工作?在
class Log2Stat(base_handler.PipelineBase):
def run(self, _date):
print "start track"
with pipeline.InOrder():
yield pipelines.Log2Bq()
print "finish track"
taskqueue.add(
url='/worker/update_daily_stat',
params={
"date": str(_date.date())
}
)
pipeline.InOrder()
和pipeline.After()
仅用于排序管道执行,而不是代码执行。在有一个名为finalized的方法,它在写入最后一个输出后立即执行,即当您的
Log2Bq()
管道完成其执行时,因此:如果你想用管道订单()或管道。之后()您应该将任务队列代码包装在其他管道中,并在
^{pr2}$pipelines.Log2Bq()
之后生成它相关问题 更多 >
编程相关推荐