Search in sources :

Example 1 with RuntimeEvent

use of org.apache.flink.runtime.event.RuntimeEvent in project flink by apache.

the class UnalignedCheckpointsCancellationTest method test.

@Test
public void test() throws Exception {
    TestInvokable invokable = new TestInvokable();
    final SingleInputGate inputGate = new SingleInputGateBuilder().setNumberOfChannels(numChannels).setChannelFactory(InputChannelBuilder::buildLocalChannel).build();
    SingleCheckpointBarrierHandler unaligner = SingleCheckpointBarrierHandler.createUnalignedCheckpointBarrierHandler(TestSubtaskCheckpointCoordinator.INSTANCE, "test", invokable, SystemClock.getInstance(), true, inputGate);
    for (RuntimeEvent e : events) {
        if (e instanceof CancelCheckpointMarker) {
            unaligner.processCancellationBarrier((CancelCheckpointMarker) e, new InputChannelInfo(0, channel));
        } else if (e instanceof CheckpointBarrier) {
            unaligner.processBarrier((CheckpointBarrier) e, new InputChannelInfo(0, channel), false);
        } else {
            throw new IllegalArgumentException("unexpected event type: " + e);
        }
    }
    assertEquals("expectAbortCheckpoint", expectAbortCheckpoint, invokable.checkpointAborted);
    assertEquals("expectTriggerCheckpoint", expectTriggerCheckpoint, invokable.checkpointTriggered);
}
Also used : CheckpointBarrier(org.apache.flink.runtime.io.network.api.CheckpointBarrier) SingleInputGateBuilder(org.apache.flink.runtime.io.network.partition.consumer.SingleInputGateBuilder) InputChannelInfo(org.apache.flink.runtime.checkpoint.channel.InputChannelInfo) CancelCheckpointMarker(org.apache.flink.runtime.io.network.api.CancelCheckpointMarker) SingleInputGate(org.apache.flink.runtime.io.network.partition.consumer.SingleInputGate) RuntimeEvent(org.apache.flink.runtime.event.RuntimeEvent) Test(org.junit.Test)

Aggregations

InputChannelInfo (org.apache.flink.runtime.checkpoint.channel.InputChannelInfo)1 RuntimeEvent (org.apache.flink.runtime.event.RuntimeEvent)1 CancelCheckpointMarker (org.apache.flink.runtime.io.network.api.CancelCheckpointMarker)1 CheckpointBarrier (org.apache.flink.runtime.io.network.api.CheckpointBarrier)1 SingleInputGate (org.apache.flink.runtime.io.network.partition.consumer.SingleInputGate)1 SingleInputGateBuilder (org.apache.flink.runtime.io.network.partition.consumer.SingleInputGateBuilder)1 Test (org.junit.Test)1