use of org.apache.flink.runtime.jobmaster.JobManagerRunnerResult in project flink by apache.
the class DispatcherTest method testCancellationOfNonCanceledTerminalJobFailsWithAppropriateException.
@Test
public void testCancellationOfNonCanceledTerminalJobFailsWithAppropriateException() throws Exception {
final CompletableFuture<JobManagerRunnerResult> jobTerminationFuture = new CompletableFuture<>();
dispatcher = createAndStartDispatcher(heartbeatServices, haServices, new FinishingJobManagerRunnerFactory(jobTerminationFuture, () -> {
}));
jobMasterLeaderElectionService.isLeader(UUID.randomUUID());
DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class);
JobID jobId = jobGraph.getJobID();
dispatcherGateway.submitJob(jobGraph, TIMEOUT).get();
jobTerminationFuture.complete(JobManagerRunnerResult.forSuccess(new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setJobID(jobId).setState(JobStatus.FINISHED).build())));
// wait for job to finish
dispatcherGateway.requestJobResult(jobId, TIMEOUT).get();
// sanity check
assertThat(dispatcherGateway.requestJobStatus(jobId, TIMEOUT).get(), is(JobStatus.FINISHED));
final CompletableFuture<Acknowledge> cancelFuture = dispatcherGateway.cancelJob(jobId, TIMEOUT);
assertThat(cancelFuture, FlinkMatchers.futureWillCompleteExceptionally(FlinkJobTerminatedWithoutCancellationException.class, Duration.ofHours(8)));
}
use of org.apache.flink.runtime.jobmaster.JobManagerRunnerResult in project flink by apache.
the class DispatcherTest method testCancellationOfCanceledTerminalDoesNotThrowException.
@Test
public void testCancellationOfCanceledTerminalDoesNotThrowException() throws Exception {
final CompletableFuture<JobManagerRunnerResult> jobTerminationFuture = new CompletableFuture<>();
dispatcher = createAndStartDispatcher(heartbeatServices, haServices, new FinishingJobManagerRunnerFactory(jobTerminationFuture, () -> {
}));
jobMasterLeaderElectionService.isLeader(UUID.randomUUID());
DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class);
JobID jobId = jobGraph.getJobID();
dispatcherGateway.submitJob(jobGraph, TIMEOUT).get();
jobTerminationFuture.complete(JobManagerRunnerResult.forSuccess(new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setJobID(jobId).setState(JobStatus.CANCELED).build())));
// wait for job to finish
dispatcherGateway.requestJobResult(jobId, TIMEOUT).get();
// sanity check
assertThat(dispatcherGateway.requestJobStatus(jobId, TIMEOUT).get(), is(JobStatus.CANCELED));
dispatcherGateway.cancelJob(jobId, TIMEOUT).get();
}
use of org.apache.flink.runtime.jobmaster.JobManagerRunnerResult in project flink by apache.
the class CheckpointResourcesCleanupRunnerTest method testResultFutureWithErrorAfterStart.
private static void testResultFutureWithErrorAfterStart(ThrowingConsumer<CheckpointResourcesCleanupRunner, ? extends Exception> preCheckLifecycleHandling) throws Exception {
final SerializedThrowable expectedError = new SerializedThrowable(new Exception("Expected exception"));
final CompletableFuture<JobManagerRunnerResult> actualResult = getResultFutureFromTestInstance(createJobResultWithFailure(expectedError), preCheckLifecycleHandling);
assertThat(actualResult).isCompletedWithValueMatching(jobManagerRunnerResult -> Objects.requireNonNull(jobManagerRunnerResult.getExecutionGraphInfo().getArchivedExecutionGraph().getFailureInfo()).getException().equals(expectedError), "JobManagerRunner should have failed with expected error");
}
use of org.apache.flink.runtime.jobmaster.JobManagerRunnerResult in project flink by apache.
the class CheckpointResourcesCleanupRunnerTest method testResultFutureWithErrorBeforeStart.
@Test
public void testResultFutureWithErrorBeforeStart() throws Exception {
final CompletableFuture<JobManagerRunnerResult> resultFuture = getResultFutureFromTestInstance(createJobResultWithFailure(new SerializedThrowable(new Exception("Expected exception"))), BEFORE_START);
assertThat(resultFuture).isNotCompleted();
}
use of org.apache.flink.runtime.jobmaster.JobManagerRunnerResult in project flink by apache.
the class DispatcherTest method testNoHistoryServerArchiveCreatedForSuspendedJob.
@Test
public void testNoHistoryServerArchiveCreatedForSuspendedJob() throws Exception {
final CompletableFuture<Void> archiveAttemptFuture = new CompletableFuture<>();
final CompletableFuture<JobManagerRunnerResult> jobTerminationFuture = new CompletableFuture<>();
dispatcher = createTestingDispatcherBuilder().setJobManagerRunnerFactory(new FinishingJobManagerRunnerFactory(jobTerminationFuture, () -> {
})).setHistoryServerArchivist(executionGraphInfo -> {
archiveAttemptFuture.complete(null);
return CompletableFuture.completedFuture(null);
}).build();
dispatcher.start();
jobMasterLeaderElectionService.isLeader(UUID.randomUUID());
DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class);
JobID jobId = jobGraph.getJobID();
dispatcherGateway.submitJob(jobGraph, TIMEOUT).get();
jobTerminationFuture.complete(JobManagerRunnerResult.forSuccess(new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setJobID(jobId).setState(JobStatus.SUSPENDED).build())));
// wait for job to finish
dispatcherGateway.requestJobResult(jobId, TIMEOUT).get();
// sanity check
assertThat(dispatcherGateway.requestJobStatus(jobId, TIMEOUT).get(), is(JobStatus.SUSPENDED));
assertThat(archiveAttemptFuture.isDone(), is(false));
}
Aggregations