Search in sources :

Example 6 with SuppressRestartsException

use of org.apache.flink.runtime.execution.SuppressRestartsException in project flink by apache.

the class ExecutionGraphSignalsTest method testSuppressRestartFailureWhileRestarting.

/**
	 * Tests that a {@link SuppressRestartsException} in state RESTARTING stops the restarting
	 * immediately and sets the execution graph's state to FAILED.
	 */
@Test
public void testSuppressRestartFailureWhileRestarting() throws IllegalAccessException, NoSuchFieldException {
    Field restartStrategyField = eg.getClass().getDeclaredField("restartStrategy");
    restartStrategyField.setAccessible(true);
    restartStrategyField.set(eg, new InfiniteDelayRestartStrategy());
    f.set(eg, JobStatus.RESTARTING);
    // suppress a possible restart
    eg.fail(new SuppressRestartsException(new Exception("Test")));
    assertEquals(JobStatus.FAILED, eg.getState());
}
Also used : Field(java.lang.reflect.Field) SuppressRestartsException(org.apache.flink.runtime.execution.SuppressRestartsException) InfiniteDelayRestartStrategy(org.apache.flink.runtime.executiongraph.restart.InfiniteDelayRestartStrategy) SuppressRestartsException(org.apache.flink.runtime.execution.SuppressRestartsException) StoppingException(org.apache.flink.runtime.StoppingException) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

SuppressRestartsException (org.apache.flink.runtime.execution.SuppressRestartsException)6 Test (org.junit.Test)4 IOException (java.io.IOException)3 InfiniteDelayRestartStrategy (org.apache.flink.runtime.executiongraph.restart.InfiniteDelayRestartStrategy)3 Instance (org.apache.flink.runtime.instance.Instance)3 ArrayList (java.util.ArrayList)2 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)2 Configuration (org.apache.flink.configuration.Configuration)2 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)2 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)2 Scheduler (org.apache.flink.runtime.jobmanager.scheduler.Scheduler)2 Deadline (scala.concurrent.duration.Deadline)2 Field (java.lang.reflect.Field)1 List (java.util.List)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 JobID (org.apache.flink.api.common.JobID)1 Time (org.apache.flink.api.common.time.Time)1 Gauge (org.apache.flink.metrics.Gauge)1 Metric (org.apache.flink.metrics.Metric)1