use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class ExecutingTest method testFailureReportedViaUpdateTaskExecutionStateCausesRestart.
@Test
public void testFailureReportedViaUpdateTaskExecutionStateCausesRestart() throws Exception {
try (MockExecutingContext ctx = new MockExecutingContext()) {
StateTrackingMockExecutionGraph returnsFailedStateExecutionGraph = new StateTrackingMockExecutionGraph();
Executing exec = new ExecutingStateBuilder().setExecutionGraph(returnsFailedStateExecutionGraph).build(ctx);
ctx.setHowToHandleFailure((failure) -> FailureResult.canRestart(failure, Duration.ZERO));
ctx.setExpectRestarting(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);
}
}
use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class ExecutingTest method testFalseReportsViaUpdateTaskExecutionStateAreIgnored.
@Test
public void testFalseReportsViaUpdateTaskExecutionStateAreIgnored() throws Exception {
try (MockExecutingContext ctx = new MockExecutingContext()) {
MockExecutionGraph returnsFailedStateExecutionGraph = new MockExecutionGraph(false, Collections::emptyList);
Executing exec = new ExecutingStateBuilder().setExecutionGraph(returnsFailedStateExecutionGraph).build(ctx);
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);
ctx.assertNoStateTransition();
}
}
use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class ApplicationDispatcherBootstrapITCase method testSubmitFailedJobOnApplicationError.
@Test
public void testSubmitFailedJobOnApplicationError() throws Exception {
final Deadline deadline = Deadline.fromNow(TIMEOUT);
final JobID jobId = new JobID();
final Configuration configuration = new Configuration();
configuration.set(HighAvailabilityOptions.HA_MODE, HighAvailabilityMode.ZOOKEEPER.name());
configuration.set(DeploymentOptions.TARGET, EmbeddedExecutor.NAME);
configuration.set(ClientOptions.CLIENT_RETRY_PERIOD, Duration.ofMillis(100));
configuration.set(DeploymentOptions.SHUTDOWN_ON_APPLICATION_FINISH, false);
configuration.set(DeploymentOptions.SUBMIT_FAILED_JOB_ON_APPLICATION_ERROR, true);
configuration.set(PipelineOptionsInternal.PIPELINE_FIXED_JOB_ID, jobId.toHexString());
final TestingMiniClusterConfiguration clusterConfiguration = TestingMiniClusterConfiguration.newBuilder().setConfiguration(configuration).build();
final EmbeddedHaServicesWithLeadershipControl haServices = new EmbeddedHaServicesWithLeadershipControl(TestingUtils.defaultExecutor());
final TestingMiniCluster.Builder clusterBuilder = TestingMiniCluster.newBuilder(clusterConfiguration).setHighAvailabilityServicesSupplier(() -> haServices).setDispatcherResourceManagerComponentFactorySupplier(createApplicationModeDispatcherResourceManagerComponentFactorySupplier(clusterConfiguration.getConfiguration(), FailingJob.getProgram()));
try (final MiniCluster cluster = clusterBuilder.build()) {
// start mini cluster and submit the job
cluster.start();
// wait until the failed job has been submitted
awaitJobStatus(cluster, jobId, JobStatus.FAILED, deadline);
final ArchivedExecutionGraph graph = cluster.getArchivedExecutionGraph(jobId).get();
assertThat(graph.getJobID()).isEqualTo(jobId);
assertThat(graph.getJobName()).isEqualTo(ApplicationDispatcherBootstrap.FAILED_JOB_NAME);
assertThat(graph.getFailureInfo()).isNotNull().extracting(ErrorInfo::getException).extracting(e -> e.deserializeError(Thread.currentThread().getContextClassLoader())).satisfies(e -> assertThat(e).isInstanceOf(ProgramInvocationException.class).hasRootCauseInstanceOf(RuntimeException.class).hasRootCauseMessage(FailingJob.EXCEPTION_MESSAGE));
}
}
use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class JobResultTest method testFailedJobIsFailureResult.
@Test
public void testFailedJobIsFailureResult() {
final JobResult jobResult = JobResult.createFrom(new ArchivedExecutionGraphBuilder().setJobID(new JobID()).setState(JobStatus.FAILED).setFailureCause(new ErrorInfo(new FlinkException("Test exception"), 42L)).build());
assertThat(jobResult.isSuccess(), is(false));
}
use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class ExecutionGraphInfoTest method testExecutionGraphHistoryBeingDerivedFromFailedExecutionGraph.
@Test
public void testExecutionGraphHistoryBeingDerivedFromFailedExecutionGraph() {
final ArchivedExecutionGraph executionGraph = ArchivedExecutionGraph.createSparseArchivedExecutionGraph(new JobID(), "test job name", JobStatus.FAILED, new RuntimeException("Expected RuntimeException"), null, System.currentTimeMillis());
final ExecutionGraphInfo executionGraphInfo = new ExecutionGraphInfo(executionGraph);
final ErrorInfo failureInfo = executionGraphInfo.getArchivedExecutionGraph().getFailureInfo();
final RootExceptionHistoryEntry actualEntry = Iterables.getOnlyElement(executionGraphInfo.getExceptionHistory());
assertThat(failureInfo).isNotNull();
assertThat(failureInfo.getException()).isEqualTo(actualEntry.getException());
assertThat(failureInfo.getTimestamp()).isEqualTo(actualEntry.getTimestamp());
assertThat(actualEntry.isGlobal()).isTrue();
assertThat(actualEntry.getFailingTaskName()).isNull();
assertThat(actualEntry.getTaskManagerLocation()).isNull();
}
Aggregations