【发布时间】:2019-07-06 12:49:56
【问题描述】:
我是 Beam 新手,正在努力寻找许多好的指南和资源来学习最佳实践。
我注意到有两种方式定义管道:
with beam.Pipeline() as p:
# pipeline code in here
或者
p = beam.Pipeline()
# pipeline code in here
result = p.run()
result.wait_until_finish()
是否有特定情况下首选每种方法?
【问题讨论】:
-
通常,这只是代码风格偏好的问题。我们最近在beam.apache.org/documentation/resources/learning-resources 上发布了额外的学习资料。希望您可以在那里看到更多示例并决定您喜欢哪种风格。此外,这里是 Python effbot.org/zone/python-with-statement.htm 中 with 语句的可能过时的解释
标签: python google-cloud-dataflow apache-beam