如何使用 Beam 2.0 创建 Dataflow 模板管道?

How to create a Dataflow template pipeline with Beam 2.0?

Dataflow 1.9 曾经有一个 TemplatingDataflowPipelineRunner,但 Beam 没有。使用 Beam 2.0 Java SDK 创建 Dataflow 模板管道的步骤是什么?

从 Beam 2.0 开始,使用 DataflowRunner 并指定 --templateLocation:

mvn compile exec:java \
 -Dexec.mainClass=com.example.myclass \
 -Dexec.args="--runner=DataflowRunner \
              --project=[YOUR_PROJECT_ID] \
              --stagingLocation=gs://[YOUR_BUCKET_NAME]/staging \
              --output=gs://[YOUR_BUCKET_NAME]/output \
              --templateLocation=gs://[YOUR_BUCKET_NAME]/templates/MyTemplate"

注意--templateLocation代替了之前的--dataflowJobFile

请参阅 Creating and staging templates 上 Java SDK 2.X

的 Dataflow 文档