Flink Streaming:如何控制执行时间 [英] Flink streaming: how to control the execution time
问题描述
Spark 流提供用于终止 awaitTermination() 的 API.有没有类似的 API 可以在 t 秒后优雅地关闭 flink 流?
Spark streaming provides API for termination awaitTermination(). Is there any similar API available to gracefully shut down flink streaming after some t seconds?
推荐答案
您在 Flink 中的驱动程序(即 main
方法)在流式作业执行时不会保持运行.你的程序应该定义一个数据流,调用execute
,然后终止.在 Spark 中,驱动程序保持运行(AFAIK),而 awaitTermination
与此相关.
Your driver program (i.e. the main
method) in Flink doesn't stay running while the streaming job executes. Your program should define a dataflow, call execute
, and then terminate. In Spark, the driver program stays running (AFAIK), and awaitTermination
relates to that.
请注意,除非您使用具有有限数量元素的有界"数据源,否则 Flink 流数据流会无限期地继续执行.您还可以取消或停止作业,甚至在停止后设置检查点以便稍后恢复.
Note that a Flink streaming dataflow continues to execute indefinitely, unless you're using a 'bounded' data source with a finite number of elements. You may also cancel or stop a job, and even take a checkpoint upon stopping to be resumed from later.
这篇关于Flink Streaming:如何控制执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!