Search in sources :

Example 1 with InputEndedEvent

use of org.apache.flink.runtime.operators.lifecycle.event.InputEndedEvent in project flink by apache.

the class DrainingValidator method validateSubtaskAttempt.

private void validateSubtaskAttempt(TestJobWithDescription job, String operatorId, int subtaskIndex, List<TestEvent> operatorEvents) {
    BitSet endedInputs = new BitSet();
    BitSet inputsWithMaxWatermark = new BitSet();
    for (TestEvent ev : operatorEvents) {
        if (ev instanceof WatermarkReceivedEvent) {
            WatermarkReceivedEvent w = (WatermarkReceivedEvent) ev;
            if (w.ts == Watermark.MAX_WATERMARK.getTimestamp()) {
                assertFalse(String.format("Max Watermark received twice by %s/%d/%d", w.operatorId, w.subtaskIndex, w.inputId), inputsWithMaxWatermark.get(w.inputId));
                inputsWithMaxWatermark.set(w.inputId);
            }
        } else if (ev instanceof InputEndedEvent) {
            InputEndedEvent w = (InputEndedEvent) ev;
            assertTrue(format("Input %d ended before receiving max watermark by %s[%d]#%d", w.inputId, operatorId, subtaskIndex, w.attemptNumber), inputsWithMaxWatermark.get(w.inputId));
            assertFalse(endedInputs.get(w.inputId));
            endedInputs.set(w.inputId);
        }
    }
    assertEquals(format("Incorrect number of ended inputs for %s[%d]", operatorId, subtaskIndex), getNumInputs(job, operatorId), endedInputs.cardinality());
}
Also used : InputEndedEvent(org.apache.flink.runtime.operators.lifecycle.event.InputEndedEvent) TestEvent(org.apache.flink.runtime.operators.lifecycle.event.TestEvent) BitSet(java.util.BitSet) WatermarkReceivedEvent(org.apache.flink.runtime.operators.lifecycle.event.WatermarkReceivedEvent)

Aggregations

BitSet (java.util.BitSet)1 InputEndedEvent (org.apache.flink.runtime.operators.lifecycle.event.InputEndedEvent)1 TestEvent (org.apache.flink.runtime.operators.lifecycle.event.TestEvent)1 WatermarkReceivedEvent (org.apache.flink.runtime.operators.lifecycle.event.WatermarkReceivedEvent)1