public class InputGateWithMetrics extends IndexedInputGate
InputGate
provided by shuffle service and it is mainly used for
increasing general input metrics from TaskIOMetricGroup
.InputGate.InputWithData<INPUT,DATA>
PullingAsyncDataInput.EndOfDataStatus
AvailabilityProvider.AvailabilityHelper
availabilityHelper, priorityAvailabilityHelper
AVAILABLE
Constructor and Description |
---|
InputGateWithMetrics(IndexedInputGate inputGate,
Counter numBytesIn) |
Modifier and Type | Method and Description |
---|---|
void |
acknowledgeAllRecordsProcessed(InputChannelInfo channelInfo) |
void |
close() |
void |
finishReadRecoveredState() |
CompletableFuture<?> |
getAvailableFuture() |
InputChannel |
getChannel(int channelIndex)
Returns the channel of this gate.
|
int |
getGateIndex()
Returns the index of this input gate.
|
Optional<BufferOrEvent> |
getNext()
Blocking call waiting for next
BufferOrEvent . |
int |
getNumberOfInputChannels() |
CompletableFuture<?> |
getPriorityEventAvailableFuture()
Notifies when a priority event has been enqueued.
|
CompletableFuture<Void> |
getStateConsumedFuture() |
List<InputChannelInfo> |
getUnfinishedChannels()
Returns the list of channels that have not received EndOfPartitionEvent.
|
PullingAsyncDataInput.EndOfDataStatus |
hasReceivedEndOfData()
Tells if we consumed all available data.
|
boolean |
isFinished() |
Optional<BufferOrEvent> |
pollNext()
Poll the
BufferOrEvent . |
void |
requestPartitions() |
void |
resumeConsumption(InputChannelInfo channelInfo) |
void |
sendTaskEvent(TaskEvent event) |
void |
setChannelStateWriter(ChannelStateWriter channelStateWriter)
Injects the
ChannelStateWriter . |
void |
setup()
Setup gate, potentially heavy-weight, blocking operation comparing to just creation.
|
void |
triggerDebloating() |
blockConsumption, checkpointStarted, checkpointStopped, convertToPriorityEvent, getInputGateIndex
getChannelInfos
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChannelInfos
and, isApproximatelyAvailable, isAvailable, or
public InputGateWithMetrics(IndexedInputGate inputGate, Counter numBytesIn)
public CompletableFuture<?> getAvailableFuture()
getAvailableFuture
in interface AvailabilityProvider
getAvailableFuture
in class InputGate
AvailabilityProvider.AVAILABLE
should be returned. Previously returned
not completed futures should become completed once there are more records available.public void resumeConsumption(InputChannelInfo channelInfo) throws IOException
resumeConsumption
in interface CheckpointableInput
resumeConsumption
in class InputGate
IOException
public void acknowledgeAllRecordsProcessed(InputChannelInfo channelInfo) throws IOException
acknowledgeAllRecordsProcessed
in class InputGate
IOException
public int getNumberOfInputChannels()
getNumberOfInputChannels
in interface CheckpointableInput
getNumberOfInputChannels
in class InputGate
public InputChannel getChannel(int channelIndex)
InputGate
getChannel
in class InputGate
public int getGateIndex()
IndexedInputGate
getGateIndex
in class IndexedInputGate
public List<InputChannelInfo> getUnfinishedChannels()
IndexedInputGate
getUnfinishedChannels
in class IndexedInputGate
public void triggerDebloating()
triggerDebloating
in class IndexedInputGate
public boolean isFinished()
isFinished
in interface PullingAsyncDataInput<BufferOrEvent>
isFinished
in class InputGate
public PullingAsyncDataInput.EndOfDataStatus hasReceivedEndOfData()
PullingAsyncDataInput
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
.
public void setup() throws IOException
InputGate
setup
in class InputGate
IOException
public CompletableFuture<Void> getStateConsumedFuture()
getStateConsumedFuture
in class InputGate
public void requestPartitions() throws IOException
requestPartitions
in class InputGate
IOException
public void setChannelStateWriter(ChannelStateWriter channelStateWriter)
ChannelStateHolder
ChannelStateWriter
. Must only be called once.setChannelStateWriter
in interface ChannelStateHolder
setChannelStateWriter
in class InputGate
public Optional<BufferOrEvent> getNext() throws IOException, InterruptedException
InputGate
BufferOrEvent
.
Note: It should be guaranteed that the previous returned buffer has been recycled before getting next one.
getNext
in class InputGate
Optional.empty()
if InputGate.isFinished()
returns true.IOException
InterruptedException
public Optional<BufferOrEvent> pollNext() throws IOException, InterruptedException
InputGate
BufferOrEvent
.
Note: It should be guaranteed that the previous returned buffer has been recycled before polling next one.
pollNext
in interface PullingAsyncDataInput<BufferOrEvent>
pollNext
in class 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 class InputGate
IOException
public CompletableFuture<?> getPriorityEventAvailableFuture()
InputGate
InputGate.getNext()
.getPriorityEventAvailableFuture
in class InputGate
public void finishReadRecoveredState() throws IOException
finishReadRecoveredState
in class InputGate
IOException
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.