Class InputGateWithMetrics
- java.lang.Object
-
- org.apache.flink.runtime.io.network.partition.consumer.InputGate
-
- org.apache.flink.runtime.io.network.partition.consumer.IndexedInputGate
-
- org.apache.flink.runtime.taskmanager.InputGateWithMetrics
-
- All Implemented Interfaces:
AutoCloseable,AvailabilityProvider,ChannelStateHolder,CheckpointableInput,PullingAsyncDataInput<BufferOrEvent>
public class InputGateWithMetrics extends IndexedInputGate
This class wrapsInputGateprovided by shuffle service and it is mainly used for increasing general input metrics fromTaskIOMetricGroup.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputGate
InputGate.InputWithData<INPUT,DATA>
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AvailabilityProvider.AvailabilityHelper
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.PullingAsyncDataInput
PullingAsyncDataInput.EndOfDataStatus
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputGate
availabilityHelper, priorityAvailabilityHelper
-
Fields inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AVAILABLE
-
-
Constructor Summary
Constructors Constructor Description InputGateWithMetrics(IndexedInputGate inputGate, org.apache.flink.metrics.Counter numBytesIn)
-
Method Summary
-
Methods inherited from class org.apache.flink.runtime.io.network.partition.consumer.IndexedInputGate
blockConsumption, checkpointStarted, checkpointStopped, convertToPriorityEvent, getInputGateIndex
-
Methods inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputGate
getChannelInfos
-
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.io.AvailabilityProvider
isApproximatelyAvailable, isAvailable
-
Methods inherited from interface org.apache.flink.runtime.io.network.partition.consumer.CheckpointableInput
getChannelInfos
-
-
-
-
Constructor Detail
-
InputGateWithMetrics
public InputGateWithMetrics(IndexedInputGate inputGate, org.apache.flink.metrics.Counter numBytesIn)
-
-
Method Detail
-
getAvailableFuture
public CompletableFuture<?> getAvailableFuture()
- Specified by:
getAvailableFuturein interfaceAvailabilityProvider- Overrides:
getAvailableFuturein classInputGate- Returns:
- a future that is completed if there are more records available. If there are more
records available immediately,
AvailabilityProvider.AVAILABLEshould be returned. Previously returned not completed futures should become completed once there are more records available.
-
resumeGateConsumption
public void resumeGateConsumption() throws IOException- Specified by:
resumeGateConsumptionin classInputGate- Throws:
IOException
-
resumeConsumption
public void resumeConsumption(InputChannelInfo channelInfo) throws IOException
- Specified by:
resumeConsumptionin interfaceCheckpointableInput- Specified by:
resumeConsumptionin classInputGate- Throws:
IOException
-
acknowledgeAllRecordsProcessed
public void acknowledgeAllRecordsProcessed(InputChannelInfo channelInfo) throws IOException
- Specified by:
acknowledgeAllRecordsProcessedin classInputGate- Throws:
IOException
-
getNumberOfInputChannels
public int getNumberOfInputChannels()
- Specified by:
getNumberOfInputChannelsin interfaceCheckpointableInput- Specified by:
getNumberOfInputChannelsin classInputGate
-
getChannel
public InputChannel getChannel(int channelIndex)
Description copied from class:InputGateReturns the channel of this gate.- Specified by:
getChannelin classInputGate
-
getGateIndex
public int getGateIndex()
Description copied from class:IndexedInputGateReturns the index of this input gate. Only supported on- Specified by:
getGateIndexin classIndexedInputGate
-
getUnfinishedChannels
public List<InputChannelInfo> getUnfinishedChannels()
Description copied from class:IndexedInputGateReturns the list of channels that have not received EndOfPartitionEvent.- Specified by:
getUnfinishedChannelsin classIndexedInputGate
-
triggerDebloating
public void triggerDebloating()
- Specified by:
triggerDebloatingin classIndexedInputGate
-
isFinished
public boolean isFinished()
- Specified by:
isFinishedin interfacePullingAsyncDataInput<BufferOrEvent>- Specified by:
isFinishedin classInputGate- Returns:
- true if is finished and for example end of input was reached, false otherwise.
-
hasReceivedEndOfData
public PullingAsyncDataInput.EndOfDataStatus hasReceivedEndOfData()
Description copied from interface:PullingAsyncDataInputTells if we consumed all available data.Moreover it tells us the reason why there is no more data incoming. If any of the upstream subtasks finished because of the stop-with-savepoint --no-drain, we should not drain the input. See also
StopMode.
-
setup
public void setup() throws IOExceptionDescription copied from class:InputGateSetup gate, potentially heavy-weight, blocking operation comparing to just creation.- Specified by:
setupin classInputGate- Throws:
IOException
-
getStateConsumedFuture
public CompletableFuture<Void> getStateConsumedFuture()
- Specified by:
getStateConsumedFuturein classInputGate
-
requestPartitions
public void requestPartitions() throws IOException- Specified by:
requestPartitionsin classInputGate- Throws:
IOException
-
setChannelStateWriter
public void setChannelStateWriter(ChannelStateWriter channelStateWriter)
Description copied from interface:ChannelStateHolderInjects theChannelStateWriter. Must only be called once.- Specified by:
setChannelStateWriterin interfaceChannelStateHolder- Overrides:
setChannelStateWriterin classInputGate
-
getNext
public Optional<BufferOrEvent> getNext() throws IOException, InterruptedException
Description copied from class:InputGateBlocking call waiting for nextBufferOrEvent.Note: It should be guaranteed that the previous returned buffer has been recycled before getting next one.
- Specified by:
getNextin classInputGate- Returns:
Optional.empty()ifInputGate.isFinished()returns true.- Throws:
IOExceptionInterruptedException
-
pollNext
public Optional<BufferOrEvent> pollNext() throws IOException, InterruptedException
Description copied from class:InputGatePoll theBufferOrEvent.Note: It should be guaranteed that the previous returned buffer has been recycled before polling next one.
- Specified by:
pollNextin interfacePullingAsyncDataInput<BufferOrEvent>- Specified by:
pollNextin classInputGate- Returns:
Optional.empty()if there is no data to return or ifInputGate.isFinished()returns true.- Throws:
IOExceptionInterruptedException
-
sendTaskEvent
public void sendTaskEvent(TaskEvent event) throws IOException
- Specified by:
sendTaskEventin classInputGate- Throws:
IOException
-
getPriorityEventAvailableFuture
public CompletableFuture<?> getPriorityEventAvailableFuture()
Description copied from class:InputGateNotifies when a priority event has been enqueued. If this future is queried from task thread, it is guaranteed that a priority event is available and retrieved throughInputGate.getNext().- Overrides:
getPriorityEventAvailableFuturein classInputGate
-
finishReadRecoveredState
public void finishReadRecoveredState() throws IOException- Specified by:
finishReadRecoveredStatein classInputGate- Throws:
IOException
-
-