更新时间:2023-11-04 10:54:04
首先,请确保您正在使用BlockingDataflowPipelineRunner.否则,您的代码将在提交作业后终止.
First, make sure you are using the BlockingDataflowPipelineRunner. Otherwise, your code will terminate after the job as submitted.
使用BlockingDataflowPipelineRunner,您应该捕获DataflowJobExecutionException来处理意外的失败,DataflowJobCancelledException来处理取消,或者超类DataflowJobException来处理所有可能的不成功终止.
With the BlockingDataflowPipelineRunner, you should catch DataflowJobExecutionException to handle unexpected failures, DataflowJobCancelledException to handle cancellations, or the superclass DataflowJobException to handle all possible non-successful terminations.
仅当作业成功时才返回PipelineResult.如果要在发生故障的情况下查询作业的属性(例如状态或聚合器),则可以使用DataflowJobException#getJob()捕获的异常访问DataflowPipelineJob对象.
The PipelineResult will only be returned if the job is successful. If you want to query properties of the job such as state or aggregators in the case of a failure, you can access the DataflowPipelineJob object from the exception that you caught with DataflowJobException#getJob().