T
- The class type of the input element.public class TerminateOnMaxIter<T> extends Object implements org.apache.flink.api.common.functions.FlatMapFunction<T,Integer>, IterationListener<Integer>
When the output of this FlatMapFunction is used as the termination criteria of an iteration body, the iteration will be executed for at most the given `maxIter` iterations.
IterationListener.Context
Constructor and Description |
---|
TerminateOnMaxIter(int maxIter) |
Modifier and Type | Method and Description |
---|---|
void |
flatMap(T integer,
org.apache.flink.util.Collector<Integer> collector) |
void |
onEpochWatermarkIncremented(int epochWatermark,
IterationListener.Context context,
org.apache.flink.util.Collector<Integer> out)
This callback is invoked every time the epoch watermark of this operator increments.
|
void |
onIterationTerminated(IterationListener.Context context,
org.apache.flink.util.Collector<Integer> collector)
This callback is invoked after the execution of the iteration body has terminated.
|
public void onEpochWatermarkIncremented(int epochWatermark, IterationListener.Context context, org.apache.flink.util.Collector<Integer> out)
IterationListener
The epochWatermark is the maximum integer that meets this requirement: every record that arrives at the operator going forward should have an epoch larger than the epochWatermark. See Java docs in IterationUtils for how epoch is determined for records ingested into the iteration body and for records emitted by operators within the iteration body.
If all inputs are bounded, the maximum epoch of all records ingested into this operator is used as the epochWatermark parameter for the last invocation of this callback.
onEpochWatermarkIncremented
in interface IterationListener<Integer>
epochWatermark
- The incremented epoch watermark.context
- A context that allows emitting side output. The context is only valid during
the invocation of this method.out
- The collector for returning result values.public void onIterationTerminated(IterationListener.Context context, org.apache.flink.util.Collector<Integer> collector)
IterationListener
onIterationTerminated
in interface IterationListener<Integer>
context
- A context that allows emitting side output. The context is only valid during
the invocation of this method.collector
- The collector for returning result values.Iterations
Copyright © 2019–2023 The Apache Software Foundation. All rights reserved.