Class AbstractIterativeTask<S extends org.apache.flink.api.common.functions.Function,OT>
- java.lang.Object
-
- org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable
-
- org.apache.flink.runtime.operators.BatchTask<S,OT>
-
- org.apache.flink.runtime.iterative.task.AbstractIterativeTask<S,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 Summary
Fields Modifier and Type Field Description protected booleanisSolutionSetUpdateprotected booleanisWorksetIterationprotected booleanisWorksetUpdateprotected org.apache.flink.api.common.aggregators.LongSumAggregatorworksetAggregatorprotected BlockingBackChannelworksetBackChannel-
Fields inherited from class org.apache.flink.runtime.operators.BatchTask
accumulatorMap, broadcastInputReaders, broadcastInputSerializers, chainedTasks, config, driver, eventualOutputs, inputComparators, inputIterators, inputReaders, inputs, inputSerializers, iterativeBroadcastInputs, iterativeInputs, localStrategies, LOG, output, resettableInputs, running, runtimeUdfContext, stub, tempBarriers
-
-
Constructor Summary
Constructors Constructor Description AbstractIterativeTask(Environment environment)Create an Invokable task and set its environment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbrokerKey()voidcancel()This method is called when a task is canceled either as a result of a user abort or an execution failure.protected voidcloseLocalStrategiesAndCaches()DistributedRuntimeUDFContextcreateRuntimeContext(org.apache.flink.metrics.groups.OperatorMetricGroup metrics)protected org.apache.flink.util.Collector<OT>createSolutionSetUpdateOutputCollector(org.apache.flink.util.Collector<OT> delegate)Creates a new solution set update output collector.protected org.apache.flink.util.Collector<OT>createWorksetUpdateOutputCollector()protected org.apache.flink.util.Collector<OT>createWorksetUpdateOutputCollector(org.apache.flink.util.Collector<OT> delegate)Creates a newWorksetUpdateOutputCollector.protected intcurrentIteration()RuntimeAggregatorRegistrygetIterationAggregators()protected voidincrementIterationCounter()protected booleaninFirstIteration()protected voidinitialize()voidrequestTermination()voidrun()booleanterminationRequested()protected voidverifyEndOfSuperstepState()-
Methods inherited from class org.apache.flink.runtime.operators.BatchTask
cancelChainedTasks, clearReaders, clearWriters, closeChainedTasks, closeUserCode, constructLogString, createInputIterator, excludeFromReset, formatLogString, getContainingTask, getDriverComparator, getInput, getInputSerializer, getIOManager, getLastOutputCollector, getLastTasksConfig, getMemoryManager, getMetricGroup, getNumTaskInputs, getOutputCollector, getOutputCollector, getStub, getTaskConfig, getTaskManagerInfo, initBroadcastInputReaders, initBroadcastInputsSerializers, initInputReaders, initInputsSerializersAndComparators, initLocalStrategies, initOutputs, initOutputs, initStub, instantiateUserCode, invoke, logAndThrowException, openChainedTasks, openUserCode, readAndSetBroadcastInput, releaseBroadcastVariables, resetAllInputs, setLastOutputCollector
-
Methods inherited from class org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable
abortCheckpointOnBarrier, cleanUp, dispatchOperatorEvent, getCurrentNumberOfSubtasks, getEnvironment, getExecutionConfig, getIndexInSubtaskGroup, getJobConfiguration, getTaskConfiguration, getUserCodeClassLoader, isUsingNonBlockingInput, maybeInterruptOnCancel, notifyCheckpointAbortAsync, notifyCheckpointCompleteAsync, notifyCheckpointSubsumedAsync, restore, triggerCheckpointAsync, triggerCheckpointOnBarrier
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.operators.TaskContext
getExecutionConfig, getUserCodeClassLoader
-
-
-
-
Field Detail
-
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 Detail
-
AbstractIterativeTask
public AbstractIterativeTask(Environment environment)
Create an Invokable task and set its environment.- Parameters:
environment- The environment assigned to this invokable.
-
-
Method Detail
-
initialize
protected void initialize() throws Exception- Overrides:
initializein classBatchTask<S extends org.apache.flink.api.common.functions.Function,OT>- Throws:
Exception
-
run
public void run() throws Exception
-
closeLocalStrategiesAndCaches
protected void closeLocalStrategiesAndCaches()
- Overrides:
closeLocalStrategiesAndCachesin classBatchTask<S extends org.apache.flink.api.common.functions.Function,OT>
-
createRuntimeContext
public DistributedRuntimeUDFContext createRuntimeContext(org.apache.flink.metrics.groups.OperatorMetricGroup metrics)
- Overrides:
createRuntimeContextin classBatchTask<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:
terminationRequestedin interfaceTerminable
-
requestTermination
public void requestTermination()
- Specified by:
requestTerminationin interfaceTerminable
-
cancel
public void cancel() throws ExceptionDescription copied from interface:TaskInvokableThis 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.
-
createWorksetUpdateOutputCollector
protected org.apache.flink.util.Collector<OT> createWorksetUpdateOutputCollector(org.apache.flink.util.Collector<OT> delegate)
Creates a newWorksetUpdateOutputCollector.This collector is used by
IterationIntermediateTaskorIterationTailTaskto update the workset.If a non-null delegate is given, the new
Collectorwill 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
IterationIntermediateTaskorIterationTailTaskto update the solution set of workset iterations. Depending on the task configuration, either a fast (non-probing)SolutionSetFastUpdateOutputCollectoror normal (re-probing)SolutionSetUpdateOutputCollectoris created.If a non-null delegate is given, the new
Collectorwill 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
SolutionSetFastUpdateOutputCollectororSolutionSetUpdateOutputCollector
-
-