Assuming I have a custom RichFunction with some raw state.
(假设我有一个带有某些原始状态的自定义RichFunction。)
How can I get the state (from every parallel instance of the operator) back to the main/driver code when the flink jobs ends? (当flink作业结束时,如何将状态(从运算符的每个并行实例)返回到主代码/驱动程序代码?)
abstract class MyRichMap extends RichMapFunction[SomeType, Unit] {
protected var someVar: Engine = _
override def open(parameters: Configuration): Unit = {
// assume someVar inititation here
....
}
override def map(value: SomeType): Unit = {
engine.process(value)
}
val env = StreamExecutionEnvironment.getExecutionEnvironment
...
someSource.map (new MyRichMap())
env.execute()
// How to get engine or some field of it here? (e.g., engine.someCounter)
what's the best way to approach this?
(解决此问题的最佳方法是什么?)
ask by user3161227 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…