问题描述
我已经设法使用Google Cloud Scheduler计划运行的数据流管道,但我也希望该管道最多运行一个小时。可以为数据流安排结束时间吗?
编辑:我创建了一个等待一定时间然后取消的管道,但是我在cancel()行IOError: Failed to get the Dataflow job id.
上遇到了错误
这是管道代码:
p = beam.Pipeline(options=PipelineOptions(region='us-central1'))
(p
| 'ReadData' >> beam.io.ReadFrompubSub(topic=TOPIC).with_output_types(bytes)
| 'Decode' >> beam.Map(lambda x:x.decode('utf-8'))
| 'WritetoBigQuery' >> beam.io.WritetoBigQuery('{0}:MarkTest.scraped'.format(PROJECT),schema=schema,write_disposition=beam.io.BigQuerydisposition.WRITE_APPEND)
)
result = p.run()
result.wait_until_finish(duration=3000)
result.cancel() # If the pipeline has not finished,you can cancel it
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)