use of org.apache.flink.runtime.client.JobExecutionException in project flink by apache.
the class StateBackendITCase method testStateBackendWithoutCheckpointing.
/**
* Verify that the user-specified state backend is used even if checkpointing is disabled.
*/
@Test
public void testStateBackendWithoutCheckpointing() throws Exception {
StreamExecutionEnvironment see = StreamExecutionEnvironment.getExecutionEnvironment();
see.setParallelism(1);
see.getConfig().setRestartStrategy(RestartStrategies.noRestart());
see.setStateBackend(new FailingStateBackend());
see.fromElements(new Tuple2<>("Hello", 1)).keyBy(0).map(new RichMapFunction<Tuple2<String, Integer>, String>() {
private static final long serialVersionUID = 1L;
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
getRuntimeContext().getState(new ValueStateDescriptor<>("Test", Integer.class));
}
@Override
public String map(Tuple2<String, Integer> value) throws Exception {
return value.f0;
}
}).print();
try {
see.execute();
fail();
} catch (JobExecutionException e) {
assertTrue(ExceptionUtils.findThrowable(e, SuccessException.class).isPresent());
}
}
use of org.apache.flink.runtime.client.JobExecutionException in project flink by apache.
the class StreamTaskTimerITCase method testOperatorChainedToSource.
/**
* Note: this test fails if we don't check for exceptions in the source contexts and do not
* synchronize in the source contexts.
*/
@Test
public void testOperatorChainedToSource() throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(timeCharacteristic);
env.setParallelism(1);
DataStream<String> source = env.addSource(new InfiniteTestSource());
source.transform("Custom Operator", BasicTypeInfo.STRING_TYPE_INFO, new TimerOperator(ChainingStrategy.ALWAYS));
try {
env.execute("Timer test");
} catch (JobExecutionException e) {
verifyJobExecutionException(e);
}
}
use of org.apache.flink.runtime.client.JobExecutionException in project flink by apache.
the class StreamTaskTimerITCase method testOneInputOperatorWithoutChaining.
/**
* Note: this test fails if we don't check for exceptions in the source contexts and do not
* synchronize in the source contexts.
*/
@Test
public void testOneInputOperatorWithoutChaining() throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(timeCharacteristic);
env.setParallelism(1);
DataStream<String> source = env.addSource(new InfiniteTestSource());
source.transform("Custom Operator", BasicTypeInfo.STRING_TYPE_INFO, new TimerOperator(ChainingStrategy.NEVER));
try {
env.execute("Timer test");
} catch (JobExecutionException e) {
verifyJobExecutionException(e);
}
}
Aggregations