使用 --experiments=upload_graph 让 Dataflowrunner 工作

Getting Dataflowrunner with --experiments=upload_graph to work

我有一个管道生成超过 API 允许限制的数据流图(序列化 JSON 表示),因此无法通过数据流启动 运行ner对于 apache beam,就像通常那样。并且 运行ning 数据流 运行ner 与指示参数 --experiments=upload_graph 不工作并且失败说没有指定的步骤。

当通过错误收到有关此尺寸问题的通知时,将提供以下信息:

the size of the serialized JSON representation of the pipeline exceeds the allowable limit for the API. 

Use experiment 'upload_graph' (--experiments=upload_graph)
to direct the runner to upload the JSON to your 
GCS staging bucket instead of embedding in the API request.

现在使用此参数确实会导致数据流 运行ner 将额外的 dataflow_graph.pb 文件上传到通常的 pipeline.pb 文件旁边的暂存位置。我证实它确实存在于 gcp 存储中。

但是 gcp 数据流中的作业在启动后立即失败,并出现以下错误:

Runnable workflow has no steps specified.

我已经用各种管道尝试过这个标志,甚至是 apache beam 示例管道,并且看到了相同的行为。

这可以通过使用字数统计示例重现:

mvn archetype:generate \
      -DarchetypeGroupId=org.apache.beam \
      -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
      -DarchetypeVersion=2.11.0 \
      -DgroupId=org.example \
      -DartifactId=word-count-beam \
      -Dversion="0.1" \
      -Dpackage=org.apache.beam.examples \
      -DinteractiveMode=false
cd word-count-beam/

运行 它没有 experiments=upload_graph 参数工作: (确保指定你的项目,如果你想 运行 this)

mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount \
     -Dexec.args="--runner=DataflowRunner --project=<your-gcp-project> \
                  --gcpTempLocation=gs://<your-gcs-bucket>/tmp \
                  --inputFile=gs://apache-beam-samples/shakespeare/* --output=gs://<your-gcs-bucket>/counts" \
     -Pdataflow-runner

运行 它与 experiments=upload_graph 导致管道失败并显示消息 workflow has no steps specified

mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount \
     -Dexec.args="--runner=DataflowRunner --project=<your-gcp-project> \
                  --gcpTempLocation=gs://<your-gcs-bucket>/tmp \
                  --experiments=upload_graph \
                  --inputFile=gs://apache-beam-samples/shakespeare/* --output=gs://<your-gcs-bucket>/counts" \
     -Pdataflow-runner

现在我希望数据流 运行ner 会指示 gcp 数据流从源代码中指定的存储桶中读取步骤:

https://github.com/apache/beam/blob/master/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java#L881

然而,情况似乎并非如此。有没有人让这个工作,或者找到了一些关于这个功能的文档可以为我指明正确的方向?

此实验已恢复,消息将在 Beam 2.13.0 中得到更正

还原PR

我最近 运行 遇到了这个问题,解决方案非常愚蠢。我开发了一个相当复杂的数据流流作业,它工作正常,第二天停止工作并出现错误“可运行的工作流没有指定步骤。”。在我的例子中,有人在创建选项后指定了 pipeline().run().waitUntilFinish() 两次,因此,我收到了这个错误。删除重复的管道 运行 解决了这个问题。我仍然认为 beam/dataflowrunner 在这种情况下应该有一些有用的错误跟踪。