use of org.apache.flink.runtime.executiongraph.restart.FailureRateRestartStrategy in project flink by apache.
the class ExecutionGraphRestartTest method taskShouldNotFailWhenFailureRateLimitWasNotExceeded.
@Test
public void taskShouldNotFailWhenFailureRateLimitWasNotExceeded() throws Exception {
FailureRateRestartStrategy restartStrategy = new FailureRateRestartStrategy(1, Time.of(1, TimeUnit.MILLISECONDS), Time.of(0, TimeUnit.SECONDS));
FiniteDuration timeout = new FiniteDuration(2, TimeUnit.SECONDS);
Tuple2<ExecutionGraph, Instance> executionGraphInstanceTuple = createExecutionGraph(restartStrategy);
ExecutionGraph eg = executionGraphInstanceTuple.f0;
//task restarted many times, but after all job is still running, because rate limit was not exceeded
restartAfterFailure(eg, timeout, false);
restartAfterFailure(eg, timeout, false);
restartAfterFailure(eg, timeout, false);
assertEquals(JobStatus.RUNNING, eg.getState());
}
use of org.apache.flink.runtime.executiongraph.restart.FailureRateRestartStrategy in project flink by apache.
the class ExecutionGraphRestartTest method taskShouldFailWhenFailureRateLimitExceeded.
@Test
public void taskShouldFailWhenFailureRateLimitExceeded() throws Exception {
FailureRateRestartStrategy restartStrategy = new FailureRateRestartStrategy(2, Time.of(10, TimeUnit.SECONDS), Time.of(0, TimeUnit.SECONDS));
FiniteDuration timeout = new FiniteDuration(2, TimeUnit.SECONDS);
Tuple2<ExecutionGraph, Instance> executionGraphInstanceTuple = createExecutionGraph(restartStrategy);
ExecutionGraph eg = executionGraphInstanceTuple.f0;
restartAfterFailure(eg, timeout, false);
restartAfterFailure(eg, timeout, false);
makeAFailureAndWait(eg, timeout);
//failure rate limit exceeded, so task should be failed
assertEquals(JobStatus.FAILED, eg.getState());
}
Aggregations