【发布时间】:2018-10-28 22:12:22
【问题描述】:
我的 apache 光束管道(使用 Python SDK+ DirecrRunner 进行测试……)正在阅读 Pubsub 主题
发布的消息和属性如下:
message: [{"col1": "test column 1", "col2": "test column 1"}]
attributes:{
'event_time_v1': str(time.time()),
'record_id': 'row-1’,
}
我正在使用函数beam.io.gcp.pubsub.ReadFromPubSub。代码/文档提到了 id_label 和 timestamp_attribute 参数(我相信这些是非常新的添加?!仅在 13 天前更新..)
- 当我使用
id_label为每个元素分配一个唯一 ID 以进行重复数据删除时,我收到以下错误:
NotImplementedError: DirectRunner: id_label is not supported for PubSub reads```
为什么会这样?我的理解是否正确,仍然缺少某些代码实现,或者我在这里遗漏了什么?
- 当我使用
timestamp_attribute = 'event_time_v1’时,为了给每个元素分配我自己的时间戳(在消息属性event_time_v1中传递的客户端事件时间),我注意到实际分配给元素的时间戳仍然是消息发布时间李>
为什么会这样?我预计会是event_time_v1
我正在使用以下 DoFn 来打印元素的时间戳
class PrintFn(beam.DoFn):
print(element, timestamp)
return [element]
非常感谢您对此的任何解释
【问题讨论】:
标签: python google-cloud-dataflow google-cloud-pubsub