在 DataFlow 上部署 Apache Beam
Apache Beam Deploying on DataFlow
您好,我已经创建了一个 Apache Beam 管道,在本地和使用数据流 运行ner 对它进行了测试,并从 Eclipse 内部 运行 对其进行了测试。我可以在 Eclipse 控制台中看到管道是 运行ning 我也看到了细节,我。 e.在控制台上登录。
现在,我该如何将此管道部署到 GCP,以便无论我的机器处于何种状态,它都能继续工作。例如,如果我 运行 使用 mvn compile exec:java 控制台显示它是 运行ning,但我无法使用数据流 UI 找到作业。
另外,如果我在本地杀死进程会发生什么,GCP 基础设施上的作业是否也会停止?我如何知道是否已独立于我的计算机在 GCP 基础架构上的状态触发作业?
带参数的maven编译exec:java输出如下,
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/C:/Users/ThakurG/.m2/repository/org/slf4j/slf4j-
jdk14/1.7.14/slf4j-jdk14-1.7.14.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/ThakurG/.m2/repository/org/slf4j/slf4j-nop/1.7.25/slf4j-nop-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
Jan 08, 2018 5:33:22 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ main
INFO: starting the process...
Jan 08, 2018 5:33:25 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ
createStream
INFO: pipeline created::Pipeline#73387971
Jan 08, 2018 5:33:27 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ main
INFO: pie crated::Pipeline#73387971
Jan 08, 2018 5:54:57 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ apply
INFO: Message received::1884408,16/09/2017,A,2007156,CLARK RUBBER FRANCHISING PTY LTD,A ,5075,6,Y,296,40467910,-34.868095,138.683535,66 SILKES RD,,,PARADISE,5075,0,7.4,5.6,18/09/2017 2:09,0.22
Jan 08, 2018 5:54:57 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ apply
INFO: Payload from msg::1884408,16/09/2017,A,2007156,CLARK RUBBER FRANCHISING PTY LTD,A ,5075,6,Y,296,40467910,-34.868095,138.683535,66 SILKES RD,,,PARADISE,5075,0,7.4,5.6,18/09/2017 2:09,0.22
Jan 08, 2018 5:54:57 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ apply
这是我在 cmd 提示符下使用的 maven 命令,
`mvn compile exec:java -Dexec.mainClass=com.trial.apps.gcp.df.ReceiveAndPersistToBQ -Dexec.args="--project=analyticspoc-XXX --stagingLocation=gs://analytics_poc_staging --runner=DataflowRunner --streaming=true"`
这是我用来创建管道并在其上设置选项的代码片段。
PipelineOptions options = PipelineOptionsFactory.create();
DataflowPipelineOptions dfOptions = options.as(DataflowPipelineOptions.class);
dfOptions.setRunner(DataflowRunner.class);
dfOptions.setJobName("gcpgteclipse");
dfOptions.setStreaming(true);
// Then create the pipeline.
Pipeline pipeL = Pipeline.create(dfOptions);
您能否阐明 "console shows it is running" 和 "can not find the job using Dataflow UI" 的确切含义?
如果您的程序输出打印消息:
To access the Dataflow monitoring console, please navigate to https://console.developers.google.com/project/.../dataflow/job/....
那么您的工作是 运行 Dataflow 服务。一旦达到 运行,终止主程序将不会停止作业 - 主程序所做的只是定期轮询 Dataflow 服务以获取作业状态和新日志消息。按照打印的 link 应该会带您到数据流 UI.
如果未打印此消息,则可能是您的程序在实际启动数据流作业之前卡在了某个地方。如果您包含程序的输出,那将有助于调试。
要部署由 Dataflow 执行的管道,您可以通过命令行或 DataflowPipelineOptions
class 指定 runner
和 project
执行参数。 runner
必须设置为 DataflowRunner
(Apache Beam 2.x.x)并且 project
设置为您的 GCP 项目 ID。参见 Specifying Execution Parameters。如果您没有在 Dataflow Jobs UI 列表中看到该作业,那么它肯定不是 运行ning in Dataflow.
如果您终止将作业部署到 Dataflow 的进程,则该作业将继续 运行 在 Dataflow 中。不会停的
这很简单,但要绝对清楚,您必须在 Pipeline
对象上调用 run()
才能执行它(并因此部署到 Dataflow)。 run()
的 return 值是一个 PipelineResult
对象,其中包含用于确定作业状态的各种方法。例如,您可以调用 pipeline.run().waitUntilFinish();
强制您的程序阻塞执行,直到作业完成。如果您的程序被阻止,那么您就知道作业已被触发。有关所有可用方法,请参阅 Apache Beam Java SDK 文档的 PipelineResult
部分。
您好,我已经创建了一个 Apache Beam 管道,在本地和使用数据流 运行ner 对它进行了测试,并从 Eclipse 内部 运行 对其进行了测试。我可以在 Eclipse 控制台中看到管道是 运行ning 我也看到了细节,我。 e.在控制台上登录。
现在,我该如何将此管道部署到 GCP,以便无论我的机器处于何种状态,它都能继续工作。例如,如果我 运行 使用 mvn compile exec:java 控制台显示它是 运行ning,但我无法使用数据流 UI 找到作业。
另外,如果我在本地杀死进程会发生什么,GCP 基础设施上的作业是否也会停止?我如何知道是否已独立于我的计算机在 GCP 基础架构上的状态触发作业?
带参数的maven编译exec:java输出如下,
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/C:/Users/ThakurG/.m2/repository/org/slf4j/slf4j-
jdk14/1.7.14/slf4j-jdk14-1.7.14.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/ThakurG/.m2/repository/org/slf4j/slf4j-nop/1.7.25/slf4j-nop-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
Jan 08, 2018 5:33:22 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ main
INFO: starting the process...
Jan 08, 2018 5:33:25 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ
createStream
INFO: pipeline created::Pipeline#73387971
Jan 08, 2018 5:33:27 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ main
INFO: pie crated::Pipeline#73387971
Jan 08, 2018 5:54:57 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ apply
INFO: Message received::1884408,16/09/2017,A,2007156,CLARK RUBBER FRANCHISING PTY LTD,A ,5075,6,Y,296,40467910,-34.868095,138.683535,66 SILKES RD,,,PARADISE,5075,0,7.4,5.6,18/09/2017 2:09,0.22
Jan 08, 2018 5:54:57 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ apply
INFO: Payload from msg::1884408,16/09/2017,A,2007156,CLARK RUBBER FRANCHISING PTY LTD,A ,5075,6,Y,296,40467910,-34.868095,138.683535,66 SILKES RD,,,PARADISE,5075,0,7.4,5.6,18/09/2017 2:09,0.22
Jan 08, 2018 5:54:57 PM com.trial.apps.gcp.df.ReceiveAndPersistToBQ apply
这是我在 cmd 提示符下使用的 maven 命令,
`mvn compile exec:java -Dexec.mainClass=com.trial.apps.gcp.df.ReceiveAndPersistToBQ -Dexec.args="--project=analyticspoc-XXX --stagingLocation=gs://analytics_poc_staging --runner=DataflowRunner --streaming=true"`
这是我用来创建管道并在其上设置选项的代码片段。
PipelineOptions options = PipelineOptionsFactory.create();
DataflowPipelineOptions dfOptions = options.as(DataflowPipelineOptions.class);
dfOptions.setRunner(DataflowRunner.class);
dfOptions.setJobName("gcpgteclipse");
dfOptions.setStreaming(true);
// Then create the pipeline.
Pipeline pipeL = Pipeline.create(dfOptions);
您能否阐明 "console shows it is running" 和 "can not find the job using Dataflow UI" 的确切含义?
如果您的程序输出打印消息:
To access the Dataflow monitoring console, please navigate to https://console.developers.google.com/project/.../dataflow/job/....
那么您的工作是 运行 Dataflow 服务。一旦达到 运行,终止主程序将不会停止作业 - 主程序所做的只是定期轮询 Dataflow 服务以获取作业状态和新日志消息。按照打印的 link 应该会带您到数据流 UI.
如果未打印此消息,则可能是您的程序在实际启动数据流作业之前卡在了某个地方。如果您包含程序的输出,那将有助于调试。
要部署由 Dataflow 执行的管道,您可以通过命令行或 DataflowPipelineOptions
class 指定 runner
和 project
执行参数。 runner
必须设置为 DataflowRunner
(Apache Beam 2.x.x)并且 project
设置为您的 GCP 项目 ID。参见 Specifying Execution Parameters。如果您没有在 Dataflow Jobs UI 列表中看到该作业,那么它肯定不是 运行ning in Dataflow.
如果您终止将作业部署到 Dataflow 的进程,则该作业将继续 运行 在 Dataflow 中。不会停的
这很简单,但要绝对清楚,您必须在 Pipeline
对象上调用 run()
才能执行它(并因此部署到 Dataflow)。 run()
的 return 值是一个 PipelineResult
对象,其中包含用于确定作业状态的各种方法。例如,您可以调用 pipeline.run().waitUntilFinish();
强制您的程序阻塞执行,直到作业完成。如果您的程序被阻止,那么您就知道作业已被触发。有关所有可用方法,请参阅 Apache Beam Java SDK 文档的 PipelineResult
部分。