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,
JobID jobId,
IntermediateDataSetID consumedResultId,
ResultPartitionType consumedPartitionType,
int consumedSubpartitionIndex,
int numberOfInputChannels,
TaskActions taskActions,
TaskIOMetricGroup metrics,
boolean isCreditBased) |
public SingleInputGate(String owningTaskName, JobID jobId, IntermediateDataSetID consumedResultId, ResultPartitionType consumedPartitionType, int consumedSubpartitionIndex, int numberOfInputChannels, TaskActions taskActions, TaskIOMetricGroup metrics, boolean isCreditBased)
public int getNumberOfInputChannels()
getNumberOfInputChannels
in interface InputGate
public IntermediateDataSetID getConsumedResultId()
public ResultPartitionType getConsumedPartitionType()
public BufferPool getBufferPool()
public int getPageSize()
getPageSize
in interface InputGate
public int getNumberOfQueuedBuffers()
public String getOwningTaskName()
getOwningTaskName
in interface InputGate
public void setBufferPool(BufferPool bufferPool)
public void assignExclusiveSegments(NetworkBufferPool networkBufferPool, int networkBuffersPerChannel) throws IOException
networkBufferPool
- The global pool to request and recycle exclusive buffersnetworkBuffersPerChannel
- The number of exclusive buffers for each channelIOException
public void returnExclusiveSegments(List<MemorySegment> segments) throws IOException
segments
- The exclusive segments need to be recycledIOException
public void setInputChannel(IntermediateResultPartitionID partitionId, InputChannel inputChannel)
public void updateInputChannel(InputChannelDeploymentDescriptor icdd) throws IOException, InterruptedException
IOException
InterruptedException
public void retriggerPartitionRequest(IntermediateResultPartitionID partitionId) throws IOException, InterruptedException
IOException
InterruptedException
public void releaseAllResources() throws IOException
IOException
public boolean isFinished()
isFinished
in interface InputGate
public void requestPartitions() throws IOException, InterruptedException
requestPartitions
in interface InputGate
IOException
InterruptedException
public Optional<BufferOrEvent> getNextBufferOrEvent() throws IOException, InterruptedException
InputGate
BufferOrEvent
.getNextBufferOrEvent
in interface InputGate
Optional.empty()
if InputGate.isFinished()
returns true.IOException
InterruptedException
public Optional<BufferOrEvent> pollNextBufferOrEvent() throws IOException, InterruptedException
InputGate
BufferOrEvent
.pollNextBufferOrEvent
in interface InputGate
Optional.empty()
if there is no data to return or if InputGate.isFinished()
returns true.IOException
InterruptedException
public void sendTaskEvent(TaskEvent event) throws IOException
sendTaskEvent
in interface InputGate
IOException
public void registerListener(InputGateListener inputGateListener)
registerListener
in interface InputGate
public static SingleInputGate create(String owningTaskName, JobID jobId, ExecutionAttemptID executionId, InputGateDeploymentDescriptor igdd, NetworkEnvironment networkEnvironment, TaskActions taskActions, TaskIOMetricGroup metrics)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.