Search in sources :

Example 1 with FailureRateRestartStrategy

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());
}
Also used : FailureRateRestartStrategy(org.apache.flink.runtime.executiongraph.restart.FailureRateRestartStrategy) Instance(org.apache.flink.runtime.instance.Instance) FiniteDuration(scala.concurrent.duration.FiniteDuration) Test(org.junit.Test)

Example 2 with FailureRateRestartStrategy

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());
}
Also used : FailureRateRestartStrategy(org.apache.flink.runtime.executiongraph.restart.FailureRateRestartStrategy) Instance(org.apache.flink.runtime.instance.Instance) FiniteDuration(scala.concurrent.duration.FiniteDuration) Test(org.junit.Test)

Aggregations

FailureRateRestartStrategy (org.apache.flink.runtime.executiongraph.restart.FailureRateRestartStrategy)2 Instance (org.apache.flink.runtime.instance.Instance)2 Test (org.junit.Test)2 FiniteDuration (scala.concurrent.duration.FiniteDuration)2