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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected booleanprotected org.apache.flink.api.common.aggregators.LongSumAggregatorprotected BlockingBackChannelFields 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
ConstructorsConstructorDescriptionAbstractIterativeTask(Environment environment) Create an Invokable task and set its environment. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()This method is called when a task is canceled either as a result of a user abort or an execution failure.protected voidcreateRuntimeContext(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>protected org.apache.flink.util.Collector<OT>createWorksetUpdateOutputCollector(org.apache.flink.util.Collector<OT> delegate) Creates a newWorksetUpdateOutputCollector.protected intprotected voidprotected booleanprotected voidvoidvoidrun()booleanprotected voidMethods 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, setLastOutputCollectorMethods 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, triggerCheckpointOnBarrierMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.runtime.operators.TaskContext
getExecutionConfig, getUserCodeClassLoader
-
Field Details
-
worksetAggregator
protected org.apache.flink.api.common.aggregators.LongSumAggregator worksetAggregator -
worksetBackChannel
-
isWorksetIteration
protected boolean isWorksetIteration -
isWorksetUpdate
protected boolean isWorksetUpdate -
isSolutionSetUpdate
protected boolean isSolutionSetUpdate
-
-
Constructor Details
-
AbstractIterativeTask
Create an Invokable task and set its environment.- Parameters:
environment- The environment assigned to this invokable.
-
-
Method Details
-
initialize
- Overrides:
initializein classBatchTask<S extends org.apache.flink.api.common.functions.Function,OT> - Throws:
Exception
-
run
-
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
-
getIterationAggregators
-
verifyEndOfSuperstepState
- Throws:
IOException
-
terminationRequested
public boolean terminationRequested()- Specified by:
terminationRequestedin interfaceTerminable
-
requestTermination
public void requestTermination()- Specified by:
requestTerminationin interfaceTerminable
-
cancel
Description 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
-
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
-