Google cloud dataflow 数据流中的DirectPipelineRunner将从本地计算机读取到Google云存储

Google cloud dataflow 数据流中的DirectPipelineRunner将从本地计算机读取到Google云存储,google-cloud-dataflow,apache-beam,dataflow,Google Cloud Dataflow,Apache Beam,Dataflow,我尝试运行一个数据流管道,使用DirectPipelineRunner从本地计算机(windows)读取数据,并写入Google云存储。作业失败,出现以下指定FileNotFoundException的错误(因此我认为数据流作业无法读取我的位置)。我正在本地计算机上运行作业,以运行我创建的基于GCP的模板。我可以在GCP数据流仪表板中看到它,但由于以下错误而失败。请帮忙。我还尝试了本地机器的IP或主机名以及本地位置,但遇到了FileNotFoundException 错误: java.io.Fi

我尝试运行一个数据流管道,使用DirectPipelineRunner从本地计算机(windows)读取数据,并写入Google云存储。作业失败,出现以下指定FileNotFoundException的错误(因此我认为数据流作业无法读取我的位置)。我正在本地计算机上运行作业,以运行我创建的基于GCP的模板。我可以在GCP数据流仪表板中看到它,但由于以下错误而失败。请帮忙。我还尝试了本地机器的IP或主机名以及本地位置,但遇到了FileNotFoundException

错误:

java.io.FileNotFoundException: No files matched spec: C:/data/sampleinput.txt
    at org.apache.beam.sdk.io.FileSystems.maybeAdjustEmptyMatchResult(FileSystems.java:172)
    at org.apache.beam.sdk.io.FileSystems.match(FileSystems.java:158)
    at org.apache.beam.sdk.io.FileBasedSource.split(FileBasedSource.java:261)
    at com.google.cloud.dataflow.worker.WorkerCustomSources.splitAndValidate(WorkerCustomSources.java:275)
用于运行模板的命令:

gcloud dataflow jobs run jobname --gcs-location gs://<somebucketname of template>/<templatename> --parameters inputFilePattern=C:/data/sampleinput.txt,outputLocation=gs://<bucketname>/output/outputfile,runner=DirectPipelineRunner
gcloud数据流作业运行jobname--gcs位置gs://--parameters inputFilePattern=C:/data/sampleinput.txt,outputLocation=gs:///outputfile,runner=DirectPipelineRunner
代码:

PCollection textData=pipeline.apply(“读取文本数据”,TextIO.Read().from(options.getInputFilePattern());
textData.apply(“写入文本数据”,TextIO.Write().to(options.getOutputLocation());

使用
gcloud dataflow jobs run
命令在云数据流上运行作业。这意味着数据流工作人员将尝试查找
C:/data/sampleinput.txt
,而这些工作人员显然不存在该文件


您可以通过将
sampleinput.txt
上传到bucket并将URI
gs:///sampleinput.txt
作为
inputFilePattern
提供来解决此问题。然后,数据流工作人员将能够找到您的输入文件,工作应该会成功。

谢谢。就在DirectRunner的帮助下,它成功了。但我需要对访问其他GCP数据源进行身份验证。您可以使用与运行数据流作业相同的GCP凭据上载文件。
PCollection<String>  textData =pipeline.apply("Read Text Data", TextIO.read().from(options.getInputFilePattern()));
    textData.apply("Write Text Data",TextIO.write().to(options.getOutputLocation()));