Search in sources :

Example 1 with OneInputTestStreamOperatorFactory

use of org.apache.flink.runtime.operators.lifecycle.graph.OneInputTestStreamOperatorFactory in project flink by apache.

the class IncrementalStateReuseAfterFailureITCase method createJob.

private TestJobWithDescription createJob() {
    StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
    env.enableCheckpointing(200);
    // reliably fails Changelog with FLINK-25395, but might affect any incremental backend
    env.enableChangelogStateBackend(true);
    env.setRestartStrategy(RestartStrategies.fixedDelayRestart(1, 1));
    // simplify debugging
    env.setMaxParallelism(1);
    // simplify debugging
    env.setParallelism(1);
    TestEventQueue evQueue = TestEventQueue.createShared(sharedObjects);
    TestCommandDispatcher cmdQueue = TestCommandDispatcher.createShared(sharedObjects);
    DataStream<TestDataElement> src = env.addSource(new TestEventSource(UID_SRC, evQueue, cmdQueue)).setUidHash(UID_SRC);
    SingleOutputStreamOperator<TestDataElement> transform1 = src.keyBy(x -> x).transform("transform-1", TypeInformation.of(TestDataElement.class), new OneInputTestStreamOperatorFactory(UID_OP1, evQueue, cmdQueue)).setUidHash(UID_OP1);
    SingleOutputStreamOperator<TestDataElement> transform2 = // chain two keyed operators, so that one is checkpointed and the other one fails
    DataStreamUtils.reinterpretAsKeyedStream(transform1, x -> x).transform("transform-2", TypeInformation.of(TestDataElement.class), new OneInputTestStreamOperatorFactory(UID_OP2, evQueue, cmdQueue)).setUidHash(UID_OP2);
    transform2.addSink(new DiscardingSink<>());
    return new TestJobWithDescription(env.getStreamGraph().getJobGraph(), emptySet(), emptySet(), emptySet(), emptyMap(), evQueue, cmdQueue);
}
Also used : TestEventSource(org.apache.flink.runtime.operators.lifecycle.graph.TestEventSource) TestEventQueue(org.apache.flink.runtime.operators.lifecycle.event.TestEventQueue) TestJobWithDescription(org.apache.flink.runtime.operators.lifecycle.TestJobWithDescription) StreamExecutionEnvironment(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment) TestCommandDispatcher(org.apache.flink.runtime.operators.lifecycle.command.TestCommandDispatcher) OneInputTestStreamOperatorFactory(org.apache.flink.runtime.operators.lifecycle.graph.OneInputTestStreamOperatorFactory) TestDataElement(org.apache.flink.runtime.operators.lifecycle.graph.TestDataElement)

Aggregations

TestJobWithDescription (org.apache.flink.runtime.operators.lifecycle.TestJobWithDescription)1 TestCommandDispatcher (org.apache.flink.runtime.operators.lifecycle.command.TestCommandDispatcher)1 TestEventQueue (org.apache.flink.runtime.operators.lifecycle.event.TestEventQueue)1 OneInputTestStreamOperatorFactory (org.apache.flink.runtime.operators.lifecycle.graph.OneInputTestStreamOperatorFactory)1 TestDataElement (org.apache.flink.runtime.operators.lifecycle.graph.TestDataElement)1 TestEventSource (org.apache.flink.runtime.operators.lifecycle.graph.TestEventSource)1 StreamExecutionEnvironment (org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)1