Class IterationHeadTask<X,Y,S extends 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>
-
- org.apache.flink.runtime.iterative.task.IterationHeadTask<X,Y,S,OT>
-
- Type Parameters:
X
- The type of the bulk partial solution / solution set and the final output.Y
- The type of the feed-back data set (bulk partial solution / workset). For bulk iterations,Y
is the same asX
- All Implemented Interfaces:
Terminable
,CheckpointableTask
,CoordinatedTask
,TaskInvokable
,TaskContext<S,OT>
public class IterationHeadTask<X,Y,S extends Function,OT> extends AbstractIterativeTask<S,OT>
The head is responsible for coordinating an iteration and can run aDriver
inside. It will read the initial input and establish aBlockingBackChannel
to the iteration's tail. After successfully processing the input, it will send EndOfSuperstep events to its outputs. It must also be connected to a synchronization task and after each superstep, it will wait until it receives anAllWorkersDoneEvent
from the sync, which signals that all other heads have also finished their iteration. Starting with the second iteration, the input for the head is the output of the tail, transmitted through the backchannel. Once the iteration is done, the head will send aTerminationEvent
to all it's connected tasks, signaling them to shutdown.Assumption on the ordering of the outputs: - The first n output gates write to channels that go to the tasks of the step function. - The next m output gates to the tasks that consume the final solution. - The last output gate connects to the synchronization task.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.iterative.task.AbstractIterativeTask
isSolutionSetUpdate, isWorksetIteration, isWorksetUpdate, worksetAggregator, worksetBackChannel
-
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 IterationHeadTask(Environment environment)
Create an Invokable task and set its environment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
getNumTaskInputs()
protected void
initOutputs()
Creates a writer for each output.void
run()
-
Methods inherited from class org.apache.flink.runtime.iterative.task.AbstractIterativeTask
brokerKey, cancel, closeLocalStrategiesAndCaches, createRuntimeContext, createSolutionSetUpdateOutputCollector, createWorksetUpdateOutputCollector, createWorksetUpdateOutputCollector, currentIteration, getIterationAggregators, incrementIterationCounter, inFirstIteration, initialize, requestTermination, terminationRequested, verifyEndOfSuperstepState
-
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, getOutputCollector, getOutputCollector, getStub, getTaskConfig, getTaskManagerInfo, initBroadcastInputReaders, initBroadcastInputsSerializers, initInputReaders, initInputsSerializersAndComparators, initLocalStrategies, 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
-
-
-
-
Constructor Detail
-
IterationHeadTask
public IterationHeadTask(Environment environment)
Create an Invokable task and set its environment.- Parameters:
environment
- The environment assigned to this invokable.
-
-
Method Detail
-
getNumTaskInputs
protected int getNumTaskInputs()
- Overrides:
getNumTaskInputs
in classBatchTask<S extends Function,OT>
-
initOutputs
protected void initOutputs() throws Exception
Description copied from class:BatchTask
Creates a writer for each output. Creates an OutputCollector which forwards its input to all writers. The output collector applies the configured shipping strategies for each writer.
-
-