public class TerminateOnMaxIterOrTol extends Object implements IterationListener<Integer>, org.apache.flink.api.common.functions.FlatMapFunction<Double,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. And the iteration will terminate once any input value is smaller than or equal to the given `tol`.
IterationListener.Context
Constructor and Description |
---|
TerminateOnMaxIterOrTol(Double tol) |
TerminateOnMaxIterOrTol(Integer maxIter,
Double tol) |
Modifier and Type | Method and Description |
---|---|
void |
flatMap(Double value,
org.apache.flink.util.Collector<Integer> out) |
void |
onEpochWatermarkIncremented(int epochWatermark,
IterationListener.Context context,
org.apache.flink.util.Collector<Integer> collector)
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 TerminateOnMaxIterOrTol(Double tol)
public void onEpochWatermarkIncremented(int epochWatermark, IterationListener.Context context, org.apache.flink.util.Collector<Integer> collector)
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.collector
- 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.