public class SingleInputGate extends Object implements InputGate
Each intermediate result is partitioned over its producing parallel subtasks; each of these partitions is furthermore partitioned into one or more subpartitions.
As an example, consider a map-reduce program, where the map operator produces data and the reduce operator consumes the produced data.
+-----+ +---------------------+ +--------+
| Map | = produce => | Intermediate Result | <= consume = | Reduce |
+-----+ +---------------------+ +--------+
When deploying such a program in parallel, the intermediate result will be partitioned over its producing parallel subtasks; each of these partitions is furthermore partitioned into one or more subpartitions.
Intermediate result
+-----------------------------------------+
| +----------------+ | +-----------------------+
+-------+ | +-------------+ +=> | Subpartition 1 | | <=======+=== | Input Gate | Reduce 1 |
| Map 1 | ==> | | Partition 1 | =| +----------------+ | | +-----------------------+
+-------+ | +-------------+ +=> | Subpartition 2 | | <==+ |
| +----------------+ | | | Subpartition request
| | | |
| +----------------+ | | |
+-------+ | +-------------+ +=> | Subpartition 1 | | <==+====+
| Map 2 | ==> | | Partition 2 | =| +----------------+ | | +-----------------------+
+-------+ | +-------------+ +=> | Subpartition 2 | | <==+======== | Input Gate | Reduce 2 |
| +----------------+ | +-----------------------+
+-----------------------------------------+
In the above example, two map subtasks produce the intermediate result in parallel, resulting in two partitions (Partition 1 and 2). Each of these partitions is further partitioned into two subpartitions -- one for each parallel reduce subtask.
| Constructor and Description |
|---|
SingleInputGate(String owningTaskName,
org.apache.flink.api.common.JobID jobId,
ExecutionAttemptID executionId,
IntermediateDataSetID consumedResultId,
int consumedSubpartitionIndex,
int numberOfInputChannels,
PartitionStateChecker partitionStateChecker,
IOMetricGroup metrics) |
public SingleInputGate(String owningTaskName, org.apache.flink.api.common.JobID jobId, ExecutionAttemptID executionId, IntermediateDataSetID consumedResultId, int consumedSubpartitionIndex, int numberOfInputChannels, PartitionStateChecker partitionStateChecker, IOMetricGroup metrics)
public int getNumberOfInputChannels()
getNumberOfInputChannels in interface InputGatepublic IntermediateDataSetID getConsumedResultId()
public int getPageSize()
getPageSize in interface InputGatepublic void setBufferPool(BufferPool bufferPool)
public void setInputChannel(IntermediateResultPartitionID partitionId, InputChannel inputChannel)
public void updateInputChannel(InputChannelDeploymentDescriptor icdd) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void retriggerPartitionRequest(IntermediateResultPartitionID partitionId) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void releaseAllResources()
throws IOException
IOExceptionpublic boolean isFinished()
isFinished in interface InputGatepublic void requestPartitions()
throws IOException,
InterruptedException
requestPartitions in interface InputGateIOExceptionInterruptedExceptionpublic BufferOrEvent getNextBufferOrEvent() throws IOException, InterruptedException
getNextBufferOrEvent in interface InputGateIOExceptionInterruptedExceptionpublic void sendTaskEvent(TaskEvent event) throws IOException
sendTaskEvent in interface InputGateIOExceptionpublic void registerListener(EventListener<InputGate> listener)
registerListener in interface InputGatepublic void onAvailableBuffer(InputChannel channel)
public static SingleInputGate create(String owningTaskName, org.apache.flink.api.common.JobID jobId, ExecutionAttemptID executionId, InputGateDeploymentDescriptor igdd, NetworkEnvironment networkEnvironment, IOMetricGroup metrics)
Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.