如何从管道内或管道 运行 之前获取数据流作业 ID?
How do I get a dataflow Job ID from within the pipeline or before the pipeline ran?
我想在实际 运行 管道之前或管道内部获取数据流的作业 ID 作为字符串。
举个例子,假设我有这个:
DataflowOptions options = optionsConst.getOptions();
Pipeline p = Pipeline.create(options);
String jobID = doSomthing(); <-- I'd like to grab the job id here
PCollection<KV<String, Object>> refData = p.apply("BigTable Access", BigtableIO.read()
.withProjectId(options.getBigtableProjectId())
.withInstanceId(options.getBigtableInstanceId())
.withTableId(options.getLookupTableId()))
.apply("Keep tags valid versions", ParDo.of(new MethodThatDoesSomethingWithJobID(**jobId**))); <-- Or inside this
无法做到这一点,因为作业 ID 是在您开始 运行 后创建的。您可以做的是在启动 运行 管道后保存输出,或者 return list job running
我想在实际 运行 管道之前或管道内部获取数据流的作业 ID 作为字符串。
举个例子,假设我有这个:
DataflowOptions options = optionsConst.getOptions();
Pipeline p = Pipeline.create(options);
String jobID = doSomthing(); <-- I'd like to grab the job id here
PCollection<KV<String, Object>> refData = p.apply("BigTable Access", BigtableIO.read()
.withProjectId(options.getBigtableProjectId())
.withInstanceId(options.getBigtableInstanceId())
.withTableId(options.getLookupTableId()))
.apply("Keep tags valid versions", ParDo.of(new MethodThatDoesSomethingWithJobID(**jobId**))); <-- Or inside this
无法做到这一点,因为作业 ID 是在您开始 运行 后创建的。您可以做的是在启动 运行 管道后保存输出,或者 return list job running