如何使用 Google Cloud Dataflow 暂存其他文件?

How can I stage additional files using Google Cloud Dataflow?

我正在阅读我的 Google Dataflow 程序中的一堆配置文件,想知道什么是暂存它们的最佳方式。目前我是这样操作的,系统找不到。

FileReader filereader1 = new FileReader("config_1.csv");
FileReader filereader2 = new FileReader("config_2.csv");

config_1.csvconfig_2.csv 存储在 ./target/classes/org/model/examples/

我的 运行 脚本如下所示:

mvn compile exec:java -Dexec.mainClass=org.model.examples.MyPipeline \
-Dexec.args="--runner=DataflowRunner \
    --project=mortgage-data-warehouse
    --gcpTempLocation=gs://my-project-bucket/tmp \
    --inputFile=gs://my-project-bucket/Data/input.txt \
    --filesToStage=./target/classes/org/datamodel/examples/config_1.csv, ./target/classes/org/datamodel/examples/config_2.csv" \    
-Pdataflow-runner

我遇到了错误

java.io.FileNotFoundException: config_1.csv (The system cannot find the file specified)

我想知道这是否是设置 --filesToStage 的正确方法。

对于小的配置文件,最好从资源文件夹中读取文件,比如这个link写的,避免使用--filesToStage

的复杂性