我在 Python 上使用 Apache Beam,想问一下Wait.on()Python SDK 上的 Apache Beam Java 相当于什么?
目前我对下面的代码片段有问题
if len(output_pcoll) > 1:
merged = (tuple(output_pcoll) |
'MergePCollections1' >> beam.Flatten())
else:
merged = output_pcoll[0]
outlier_side_input = self.construct_outlier_side_input(merged)
(merged |
"RemoveOutlier" >>
beam.ParDo(utils.Remove_Outliers(),
beam.pvalue.AsDict(outlier_side_input)) |
"WriteToCSV" >>
beam.io.WriteToText('../../ML-DATA/{0}.{1}'.format(self.BUCKET,
self.OUTPUT), num_shards=1))
Run Code Online (Sandbox Code Playgroud)
看来 Apache Beam 不会等到代码self.construct_outlier_side_input执行完成,并在下一个管道中执行“RemoveOutlier”时导致空侧输入。在Java版本中你可以使用Wait.On()等待construct_outlier_side_input完成执行,但是我在Python SDK中找不到等效的方法。
--编辑--我想要实现的目标几乎与此链接中的相同, https://rmannibucau.metawerx.net/post/apache-beam-initialization-destruction-task