Class AbstractIterativeTask<S extends org.apache.flink.api.common.functions.Function,OT>

All Implemented Interfaces:
Terminable, CheckpointableTask, CoordinatedTask, TaskInvokable, TaskContext<S,OT>
Direct Known Subclasses:
IterationHeadTask, IterationIntermediateTask, IterationTailTask

public abstract class AbstractIterativeTask<S extends org.apache.flink.api.common.functions.Function,OT> extends BatchTask<S,OT> implements Terminable
The abstract base class for all tasks able to participate in an iteration.
  • Field Details

    • worksetAggregator

      protected org.apache.flink.api.common.aggregators.LongSumAggregator worksetAggregator
    • worksetBackChannel

      protected BlockingBackChannel worksetBackChannel
    • isWorksetIteration

      protected boolean isWorksetIteration
    • isWorksetUpdate

      protected boolean isWorksetUpdate
    • isSolutionSetUpdate

      protected boolean isSolutionSetUpdate
  • Constructor Details

    • AbstractIterativeTask

      public AbstractIterativeTask(Environment environment)
      Create an Invokable task and set its environment.
      Parameters:
      environment - The environment assigned to this invokable.
  • Method Details

    • initialize

      protected void initialize() throws Exception
      Overrides:
      initialize in class BatchTask<S extends org.apache.flink.api.common.functions.Function,OT>
      Throws:
      Exception
    • run

      public void run() throws Exception
      Overrides:
      run in class BatchTask<S extends org.apache.flink.api.common.functions.Function,OT>
      Throws:
      Exception
    • closeLocalStrategiesAndCaches

      protected void closeLocalStrategiesAndCaches()
      Overrides:
      closeLocalStrategiesAndCaches in class BatchTask<S extends org.apache.flink.api.common.functions.Function,OT>
    • createRuntimeContext

      public DistributedRuntimeUDFContext createRuntimeContext(org.apache.flink.metrics.groups.OperatorMetricGroup metrics)
      Overrides:
      createRuntimeContext in class BatchTask<S extends org.apache.flink.api.common.functions.Function,OT>
    • inFirstIteration

      protected boolean inFirstIteration()
    • currentIteration

      protected int currentIteration()
    • incrementIterationCounter

      protected void incrementIterationCounter()
    • brokerKey

      public String brokerKey()
    • getIterationAggregators

      public RuntimeAggregatorRegistry getIterationAggregators()
    • verifyEndOfSuperstepState

      protected void verifyEndOfSuperstepState() throws IOException
      Throws:
      IOException
    • terminationRequested

      public boolean terminationRequested()
      Specified by:
      terminationRequested in interface Terminable
    • requestTermination

      public void requestTermination()
      Specified by:
      requestTermination in interface Terminable
    • cancel

      public void cancel() throws Exception
      Description copied from interface: TaskInvokable
      This method is called when a task is canceled either as a result of a user abort or an execution failure. It can be overwritten to respond to shut down the user code properly.
      Specified by:
      cancel in interface TaskInvokable
      Overrides:
      cancel in class BatchTask<S extends org.apache.flink.api.common.functions.Function,OT>
      Throws:
      Exception
    • createWorksetUpdateOutputCollector

      protected org.apache.flink.util.Collector<OT> createWorksetUpdateOutputCollector(org.apache.flink.util.Collector<OT> delegate)
      Creates a new WorksetUpdateOutputCollector.

      This collector is used by IterationIntermediateTask or IterationTailTask to update the workset.

      If a non-null delegate is given, the new Collector will write to the solution set and also call collect(T) of the delegate.

      Parameters:
      delegate - null -OR- the delegate on which to call collect() by the newly created collector
      Returns:
      a new WorksetUpdateOutputCollector
    • createWorksetUpdateOutputCollector

      protected org.apache.flink.util.Collector<OT> createWorksetUpdateOutputCollector()
    • createSolutionSetUpdateOutputCollector

      protected org.apache.flink.util.Collector<OT> createSolutionSetUpdateOutputCollector(org.apache.flink.util.Collector<OT> delegate)
      Creates a new solution set update output collector.

      This collector is used by IterationIntermediateTask or IterationTailTask to update the solution set of workset iterations. Depending on the task configuration, either a fast (non-probing) SolutionSetFastUpdateOutputCollector or normal (re-probing) SolutionSetUpdateOutputCollector is created.

      If a non-null delegate is given, the new Collector will write back to the solution set and also call collect(T) of the delegate.

      Parameters:
      delegate - null -OR- a delegate collector to be called by the newly created collector
      Returns:
      a new SolutionSetFastUpdateOutputCollector or SolutionSetUpdateOutputCollector