org.apache.flink.runtime.executiongraph.utils.NotCancelAckingTaskGateway Java Examples

The following examples show how to use org.apache.flink.runtime.executiongraph.utils.NotCancelAckingTaskGateway. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExecutionGraphRestartTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testGlobalFailAndRestarts() throws Exception {
	final int parallelism = 10;
	final JobID jid = new JobID();
	final JobVertex vertex = createNoOpVertex(parallelism);
	final NotCancelAckingTaskGateway taskManagerGateway = new NotCancelAckingTaskGateway();
	final SlotProvider slots = new SimpleSlotProvider(jid, parallelism, taskManagerGateway);
	final TestRestartStrategy restartStrategy = TestRestartStrategy.manuallyTriggered();

	final ExecutionGraph eg = createSimpleTestGraph(jid, slots, restartStrategy, vertex);
	eg.start(mainThreadExecutor);

	eg.setScheduleMode(ScheduleMode.EAGER);
	eg.scheduleForExecution();

	switchToRunning(eg);

	// fail into 'RESTARTING'
	eg.failGlobal(new Exception("intended test failure 1"));
	assertEquals(JobStatus.FAILING, eg.getState());

	completeCancellingForAllVertices(eg);

	assertEquals(JobStatus.RESTARTING, eg.getState());

	eg.failGlobal(new Exception("intended test failure 2"));
	assertEquals(JobStatus.RESTARTING, eg.getState());

	restartStrategy.triggerAll().join();

	assertEquals(JobStatus.RUNNING, eg.getState());

	switchToRunning(eg);
	finishAllVertices(eg);

	eg.waitUntilTerminal();
	assertEquals(JobStatus.FINISHED, eg.getState());

	if (eg.getNumberOfFullRestarts() > 2) {
		fail("Too many restarts: " + eg.getNumberOfFullRestarts());
	}
}
 
Example #2
Source File: ExecutionGraphRestartTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testGlobalFailAndRestarts() throws Exception {
	final int parallelism = 10;
	final JobVertex vertex = createNoOpVertex(parallelism);
	final NotCancelAckingTaskGateway taskManagerGateway = new NotCancelAckingTaskGateway();
	final SlotProvider slots = new SimpleSlotProvider(TEST_JOB_ID, parallelism, taskManagerGateway);
	final TestRestartStrategy restartStrategy = TestRestartStrategy.manuallyTriggered();

	final ExecutionGraph eg = new ExecutionGraphTestUtils.TestingExecutionGraphBuilder(TEST_JOB_ID, vertex)
		.setSlotProvider(slots)
		.setRestartStrategy(restartStrategy)
		.setScheduleMode(ScheduleMode.EAGER)
		.build();

	eg.start(mainThreadExecutor);

	eg.scheduleForExecution();

	switchToRunning(eg);

	// fail into 'RESTARTING'
	eg.failGlobal(new Exception("intended test failure 1"));
	assertEquals(JobStatus.FAILING, eg.getState());

	completeCancellingForAllVertices(eg);

	assertEquals(JobStatus.RESTARTING, eg.getState());

	eg.failGlobal(new Exception("intended test failure 2"));
	assertEquals(JobStatus.RESTARTING, eg.getState());

	restartStrategy.triggerAll().join();

	assertEquals(JobStatus.RUNNING, eg.getState());

	switchToRunning(eg);
	finishAllVertices(eg);

	eg.waitUntilTerminal();
	assertEquals(JobStatus.FINISHED, eg.getState());

	if (eg.getNumberOfFullRestarts() > 2) {
		fail("Too many restarts: " + eg.getNumberOfFullRestarts());
	}
}
 
Example #3
Source File: ExecutionGraphRestartTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testGlobalFailAndRestarts() throws Exception {
	final int parallelism = 10;
	final JobVertex vertex = createNoOpVertex(parallelism);
	final NotCancelAckingTaskGateway taskManagerGateway = new NotCancelAckingTaskGateway();
	final SlotProvider slots = new SimpleSlotProvider(parallelism, taskManagerGateway);
	final TestRestartStrategy restartStrategy = TestRestartStrategy.manuallyTriggered();

	final JobGraph jobGraph = new JobGraph(TEST_JOB_ID, "Test Job", vertex);
	jobGraph.setScheduleMode(ScheduleMode.EAGER);
	final ExecutionGraph eg = TestingExecutionGraphBuilder
		.newBuilder()
		.setJobGraph(jobGraph)
		.setSlotProvider(slots)
		.setRestartStrategy(restartStrategy)
		.build();

	startAndScheduleExecutionGraph(eg);

	switchToRunning(eg);

	// fail into 'RESTARTING'
	eg.failGlobal(new Exception("intended test failure 1"));
	assertEquals(JobStatus.FAILING, eg.getState());

	completeCancellingForAllVertices(eg);

	assertEquals(JobStatus.RESTARTING, eg.getState());

	eg.failGlobal(new Exception("intended test failure 2"));
	assertEquals(JobStatus.RESTARTING, eg.getState());

	restartStrategy.triggerAll().join();

	assertEquals(JobStatus.RUNNING, eg.getState());

	switchToRunning(eg);
	finishAllVertices(eg);

	eg.waitUntilTerminal();
	assertEquals(JobStatus.FINISHED, eg.getState());

	assertThat("Too many restarts", eg.getNumberOfRestarts(), is(lessThanOrEqualTo(2L)));
}