use of org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition in project flink by apache.
the class AdaptiveSchedulerTest method testUpdateTaskExecutionStateReturnsFalseInIllegalState.
@Test
public void testUpdateTaskExecutionStateReturnsFalseInIllegalState() throws Exception {
final JobGraph jobGraph = createJobGraph();
final AdaptiveScheduler scheduler = new AdaptiveSchedulerBuilder(jobGraph, mainThreadExecutor).build();
assertThat(scheduler.updateTaskExecutionState(new TaskExecutionStateTransition(new TaskExecutionState(new ExecutionAttemptID(), ExecutionState.FAILED)))).isFalse();
}
use of org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition in project flink by apache.
the class AdaptiveSchedulerTest method testExceptionHistoryWithTaskFailureWithRestart.
@Test
public void testExceptionHistoryWithTaskFailureWithRestart() throws Exception {
final Exception expectedException = new Exception("Expected Local Exception");
Consumer<AdaptiveSchedulerBuilder> setupScheduler = builder -> builder.setRestartBackoffTimeStrategy(new FixedDelayRestartBackoffTimeStrategy.FixedDelayRestartBackoffTimeStrategyFactory(1, 100).create());
BiConsumer<AdaptiveScheduler, List<ExecutionAttemptID>> testLogic = (scheduler, attemptIds) -> {
final ExecutionAttemptID attemptId = attemptIds.get(1);
scheduler.updateTaskExecutionState(new TaskExecutionStateTransition(new TaskExecutionState(attemptId, ExecutionState.FAILED, expectedException)));
};
final Iterable<RootExceptionHistoryEntry> actualExceptionHistory = runExceptionHistoryTests(testLogic, setupScheduler);
assertThat(actualExceptionHistory).hasSize(1);
final RootExceptionHistoryEntry failure = actualExceptionHistory.iterator().next();
assertThat(failure.getException().deserializeError(classLoader)).isEqualTo(expectedException);
}
use of org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition in project flink by apache.
the class FailingTest method testTaskFailuresAreIgnored.
@Test
public void testTaskFailuresAreIgnored() throws Exception {
try (MockFailingContext ctx = new MockFailingContext()) {
StateTrackingMockExecutionGraph meg = new StateTrackingMockExecutionGraph();
Failing failing = createFailingState(ctx, meg);
// register execution at EG
Exception exception = new RuntimeException();
TestingAccessExecution execution = TestingAccessExecution.newBuilder().withExecutionState(ExecutionState.FAILED).withErrorInfo(new ErrorInfo(exception, System.currentTimeMillis())).build();
meg.registerExecution(execution);
TaskExecutionStateTransition update = ExecutingTest.createFailingStateTransition(execution.getAttemptId(), exception);
failing.updateTaskExecutionState(update);
ctx.assertNoStateTransition();
}
}
use of org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition in project flink by apache.
the class StopWithSavepointTest method testFailingOnUpdateTaskExecutionStateWithNoRestart.
@Test
public void testFailingOnUpdateTaskExecutionStateWithNoRestart() throws Exception {
try (MockStopWithSavepointContext ctx = new MockStopWithSavepointContext()) {
StateTrackingMockExecutionGraph executionGraph = new StateTrackingMockExecutionGraph();
StopWithSavepoint sws = createStopWithSavepoint(ctx, executionGraph);
ctx.setStopWithSavepoint(sws);
ctx.setHowToHandleFailure(FailureResult::canNotRestart);
ctx.setExpectFailing(failingArguments -> {
assertThat(failingArguments.getFailureCause(), containsCause(RuntimeException.class));
});
Exception exception = new RuntimeException();
TestingAccessExecution execution = TestingAccessExecution.newBuilder().withExecutionState(ExecutionState.FAILED).withErrorInfo(new ErrorInfo(exception, System.currentTimeMillis())).build();
executionGraph.registerExecution(execution);
TaskExecutionStateTransition taskExecutionStateTransition = ExecutingTest.createFailingStateTransition(execution.getAttemptId(), exception);
assertThat(sws.updateTaskExecutionState(taskExecutionStateTransition), is(true));
}
}
use of org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition in project flink by apache.
the class ExecutingTest method testFailureReportedViaUpdateTaskExecutionStateCausesFailingOnNoRestart.
@Test
public void testFailureReportedViaUpdateTaskExecutionStateCausesFailingOnNoRestart() throws Exception {
try (MockExecutingContext ctx = new MockExecutingContext()) {
StateTrackingMockExecutionGraph returnsFailedStateExecutionGraph = new StateTrackingMockExecutionGraph();
Executing exec = new ExecutingStateBuilder().setExecutionGraph(returnsFailedStateExecutionGraph).build(ctx);
ctx.setHowToHandleFailure(FailureResult::canNotRestart);
ctx.setExpectFailing(assertNonNull());
Exception exception = new RuntimeException();
TestingAccessExecution execution = TestingAccessExecution.newBuilder().withExecutionState(ExecutionState.FAILED).withErrorInfo(new ErrorInfo(exception, System.currentTimeMillis())).build();
returnsFailedStateExecutionGraph.registerExecution(execution);
TaskExecutionStateTransition taskExecutionStateTransition = createFailingStateTransition(execution.getAttemptId(), exception);
exec.updateTaskExecutionState(taskExecutionStateTransition);
}
}
Aggregations