Interface Driver<S extends org.apache.flink.api.common.functions.Function,OT>

Type Parameters:
S - The type of stub driven by this driver.
OT - The data type of the records produced by this driver.
All Known Subinterfaces:
ResettableDriver<S,OT>
All Known Implementing Classes:
AbstractCachedBuildSideJoinDriver, AbstractOuterJoinDriver, AllGroupCombineDriver, AllGroupReduceDriver, AllReduceDriver, BuildFirstCachedJoinDriver, BuildSecondCachedJoinDriver, CoGroupDriver, CoGroupRawDriver, CoGroupWithSolutionSetFirstDriver, CoGroupWithSolutionSetSecondDriver, CrossDriver, FlatMapDriver, FullOuterJoinDriver, GroupReduceCombineDriver, GroupReduceDriver, JoinDriver, JoinWithSolutionSetFirstDriver, JoinWithSolutionSetSecondDriver, LeftOuterJoinDriver, MapDriver, MapPartitionDriver, NoOpDriver, ReduceCombineDriver, ReduceDriver, RightOuterJoinDriver, UnionWithTempOperator

public interface Driver<S extends org.apache.flink.api.common.functions.Function,OT>
The interface to be implemented by all drivers that run alone (or as the primary driver) in a task. A driver implements the actual code to perform a batch operation, like map(), reduce(), join(), or coGroup().
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method is invoked when the driver must aborted in mid processing.
    void
    This method is invoked in any case (clean termination and exception) at the end of the tasks operation.
    int
    Gets the number of comparators required for this driver.
    int
    Gets the number of inputs that the task has.
    Gets the class of the stub type that is run by this task.
    void
    This method is called before the user code is opened.
    void
    run()
    The main operation method of the task.
    void
    setup(TaskContext<S,OT> context)
     
  • Method Details

    • setup

      void setup(TaskContext<S,OT> context)
    • getNumberOfInputs

      int getNumberOfInputs()
      Gets the number of inputs that the task has.
      Returns:
      The number of inputs.
    • getNumberOfDriverComparators

      int getNumberOfDriverComparators()
      Gets the number of comparators required for this driver.
      Returns:
      The number of comparators required for this driver.
    • getStubType

      Class<S> getStubType()
      Gets the class of the stub type that is run by this task. For example, a MapTask should return MapFunction.class.
      Returns:
      The class of the stub type run by the task.
    • prepare

      void prepare() throws Exception
      This method is called before the user code is opened. An exception thrown by this method signals failure of the task.
      Throws:
      Exception - Exceptions may be forwarded and signal task failure.
    • run

      void run() throws Exception
      The main operation method of the task. It should call the user code with the data subsets until the input is depleted.
      Throws:
      Exception - Any exception thrown by this method signals task failure. Because exceptions in the user code typically signal situations where this instance in unable to proceed, exceptions from the user code should be forwarded.
    • cleanup

      void cleanup() throws Exception
      This method is invoked in any case (clean termination and exception) at the end of the tasks operation.
      Throws:
      Exception - Exceptions may be forwarded.
    • cancel

      void cancel() throws Exception
      This method is invoked when the driver must aborted in mid processing. It is invoked asynchronously by a different thread.
      Throws:
      Exception - Exceptions may be forwarded.