use of org.apache.flink.runtime.scheduler.exceptionhistory.ExceptionHistoryEntry in project flink by apache.
the class AdaptiveSchedulerTest method testExceptionHistoryWithTaskConcurrentGlobalFailure.
@Test
public void testExceptionHistoryWithTaskConcurrentGlobalFailure() throws Exception {
final Exception expectedException1 = new Exception("Expected Global Exception 1");
final Exception expectedException2 = new Exception("Expected Global Exception 2");
BiConsumer<AdaptiveScheduler, List<ExecutionAttemptID>> testLogic = (scheduler, attemptIds) -> {
scheduler.handleGlobalFailure(expectedException1);
scheduler.handleGlobalFailure(expectedException2);
};
final Iterable<RootExceptionHistoryEntry> entries = runExceptionHistoryTests(testLogic);
assertThat(entries).hasSize(1);
final RootExceptionHistoryEntry failure = entries.iterator().next();
assertThat(failure.getException().deserializeError(classLoader)).isEqualTo(expectedException1);
final Iterable<ExceptionHistoryEntry> concurrentExceptions = failure.getConcurrentExceptions();
final List<Throwable> foundExceptions = IterableUtils.toStream(concurrentExceptions).map(ExceptionHistoryEntry::getException).map(exception -> exception.deserializeError(classLoader)).collect(Collectors.toList());
assertThat(foundExceptions).containsExactly(expectedException2);
}
use of org.apache.flink.runtime.scheduler.exceptionhistory.ExceptionHistoryEntry in project flink by apache.
the class AdaptiveSchedulerTest method testExceptionHistoryWithTaskConcurrentFailure.
@Test
public void testExceptionHistoryWithTaskConcurrentFailure() throws Exception {
final Exception expectedException1 = new Exception("Expected Local Exception 1");
final Exception expectedException2 = new Exception("Expected Local Exception 2");
BiConsumer<AdaptiveScheduler, List<ExecutionAttemptID>> testLogic = (scheduler, attemptIds) -> {
final ExecutionAttemptID attemptId = attemptIds.remove(0);
final ExecutionAttemptID attemptId2 = attemptIds.remove(0);
scheduler.updateTaskExecutionState(new TaskExecutionStateTransition(new TaskExecutionState(attemptId, ExecutionState.FAILED, expectedException1)));
scheduler.updateTaskExecutionState(new TaskExecutionStateTransition(new TaskExecutionState(attemptId2, ExecutionState.FAILED, expectedException2)));
};
final Iterable<RootExceptionHistoryEntry> entries = runExceptionHistoryTests(testLogic);
assertThat(entries).hasSize(1);
final RootExceptionHistoryEntry failure = entries.iterator().next();
assertThat(failure.getException().deserializeError(classLoader)).isEqualTo(expectedException1);
final Iterable<ExceptionHistoryEntry> concurrentExceptions = failure.getConcurrentExceptions();
final List<Throwable> foundExceptions = IterableUtils.toStream(concurrentExceptions).map(ExceptionHistoryEntry::getException).map(exception -> exception.deserializeError(classLoader)).collect(Collectors.toList());
// In the future, concurrent local failures should be stored.
assertThat(foundExceptions).isEmpty();
}
Aggregations