Apache Beam FiredWindow不做GroupByKey转换后做任何事情
我构建了一条管道,该管道从Confluent Kafka读取它处理记录,然后使用侧面输出将其分成被拒绝和批准的PCollections,然后批准的PCollections将其写入BigQuery,但我想坚持批准的记录并将其写入文件中在GCS上。
该代码是:
windowing=(aproved
| 'Create_window' >> beam.WindowInto(window.FixedWindows(60))
| 'AddKey' >> beam.Map(lambda record: (none,record))
| 'GBK' >> beam.GroupByKey()
| 'remove_key' >> beam.FlatMap(ret_key)
| 'AddTimeStamp' >> beam.Map(lambda record: beam.window.TimestampValue(record,time.time()))
| 'Write' >> WriteToFiles(path=MY_BUCKET,file_naming=destination_prefix_naming('.ppl'))
)
当我测试它从文件读取并使用Direct Runner时,这起作用,但是当我使用dataflow和流式传输时,GroupByKey转换后没有做任何事情,它在图上说添加了20个元素,但是下一个转换('remove_key')在那之后再也没有元素
I built a pipeline which reads from confluent kafka it processes the records and then use side outputs to split them into rejected and approved pcollections, then the approved pcollections gets written to bigquery, but I want to persist the approved records and write them into a file on gcs.
The code is:
windowing=(aproved
| 'Create_window' >> beam.WindowInto(window.FixedWindows(60))
| 'AddKey' >> beam.Map(lambda record: (none,record))
| 'GBK' >> beam.GroupByKey()
| 'remove_key' >> beam.FlatMap(ret_key)
| 'AddTimeStamp' >> beam.Map(lambda record: beam.window.TimestampValue(record,time.time()))
| 'Write' >> WriteToFiles(path=MY_BUCKET,file_naming=destination_prefix_naming('.ppl'))
)
This works when I test it reading from a file and using direct runner, but when I use dataflow and streaming it just doesn't do anything after the GroupByKey transform, it says on the graph that 20 element were added, but the next transform ('remove_key') never gets an element after that
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论