Class IterationHeadTask<X,Y,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>
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,Yis the same asX
- All Implemented Interfaces:
Terminable,CheckpointableTask,CoordinatedTask,TaskInvokable,TaskContext<S,OT>
public class IterationHeadTask<X,Y,S extends org.apache.flink.api.common.functions.Function,OT>
extends AbstractIterativeTask<S,OT>
The head is responsible for coordinating an iteration and can run a
Driver inside. It
will read the initial input and establish a BlockingBackChannel 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 an AllWorkersDoneEvent 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 a TerminationEvent 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, worksetBackChannelFields 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
ConstructorsConstructorDescriptionIterationHeadTask(Environment environment) Create an Invokable task and set its environment. -
Method Summary
Modifier and TypeMethodDescriptionprotected intprotected voidCreates a writer for each output.voidrun()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, verifyEndOfSuperstepStateMethods 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, 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
-
Constructor Details
-
IterationHeadTask
Create an Invokable task and set its environment.- Parameters:
environment- The environment assigned to this invokable.
-
-
Method Details
-
getNumTaskInputs
protected int getNumTaskInputs()- Overrides:
getNumTaskInputsin classBatchTask<S extends org.apache.flink.api.common.functions.Function,OT>
-
initOutputs
Description copied from class:BatchTaskCreates 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.- Overrides:
initOutputsin classBatchTask<S extends org.apache.flink.api.common.functions.Function,OT> - Throws:
Exception
-
run
- Overrides:
runin classAbstractIterativeTask<S extends org.apache.flink.api.common.functions.Function,OT> - Throws:
Exception
-