use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo 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.scheduler.ExecutionGraphInfo in project flink by apache.
the class DispatcherResourceCleanupTest method testGlobalCleanupWhenJobFinishedWhileClosingDispatcher.
@Test
public void testGlobalCleanupWhenJobFinishedWhileClosingDispatcher() throws Exception {
final TestingJobManagerRunner testingJobManagerRunner = TestingJobManagerRunner.newBuilder().setBlockingTermination(true).setJobId(jobId).build();
final Queue<JobManagerRunner> jobManagerRunners = new ArrayDeque<>(Arrays.asList(testingJobManagerRunner));
startDispatcher(new QueueJobManagerRunnerFactory(jobManagerRunners));
submitJobAndWait();
final CompletableFuture<Void> dispatcherTerminationFuture = dispatcher.closeAsync();
testingJobManagerRunner.getCloseAsyncCalledLatch().await();
testingJobManagerRunner.completeResultFuture(new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setJobID(jobId).setState(JobStatus.FINISHED).build()));
testingJobManagerRunner.completeTerminationFuture();
// check that no exceptions have been thrown
dispatcherTerminationFuture.get();
assertGlobalCleanupTriggered(jobId);
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class MiniDispatcherTest method testShutdownIfJobCancelledInNormalMode.
@Test
public void testShutdownIfJobCancelledInNormalMode() throws Exception {
final MiniDispatcher miniDispatcher = createMiniDispatcher(ClusterEntrypoint.ExecutionMode.NORMAL);
miniDispatcher.start();
try {
// wait until we have submitted the job
final TestingJobManagerRunner testingJobManagerRunner = testingJobManagerRunnerFactory.takeCreatedJobManagerRunner();
assertFalse(miniDispatcher.getTerminationFuture().isDone());
final DispatcherGateway dispatcherGateway = miniDispatcher.getSelfGateway(DispatcherGateway.class);
dispatcherGateway.cancelJob(jobGraph.getJobID(), Time.seconds(10L));
testingJobManagerRunner.completeResultFuture(new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setJobID(jobGraph.getJobID()).setState(JobStatus.CANCELED).build()));
ApplicationStatus applicationStatus = miniDispatcher.getShutDownFuture().get();
assertThat(applicationStatus, is(ApplicationStatus.CANCELED));
} finally {
RpcUtils.terminateRpcEndpoint(miniDispatcher, timeout);
}
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class MiniDispatcherTest method setupClass.
@BeforeClass
public static void setupClass() throws IOException {
jobGraph = JobGraphTestUtils.singleNoOpJobGraph();
executionGraphInfo = new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setJobID(jobGraph.getJobID()).setState(JobStatus.FINISHED).build());
rpcService = new TestingRpcService();
configuration = new Configuration();
blobServer = new BlobServer(configuration, temporaryFolder.newFolder(), new VoidBlobStore());
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class MemoryExecutionGraphInfoStoreTest method testMaximumCapacity.
/**
* Tests that the size of {@link MemoryExecutionGraphInfoStore} is no more than the configured
* max capacity and the old execution graphs will be purged if the total added number exceeds
* the max capacity.
*/
@Test
public void testMaximumCapacity() throws IOException {
final int maxCapacity = 10;
final int numberExecutionGraphs = 10;
final Collection<ExecutionGraphInfo> oldExecutionGraphInfos = generateTerminalExecutionGraphInfos(numberExecutionGraphs);
final Collection<ExecutionGraphInfo> newExecutionGraphInfos = generateTerminalExecutionGraphInfos(numberExecutionGraphs);
final Collection<JobDetails> jobDetails = generateJobDetails(newExecutionGraphInfos);
try (final MemoryExecutionGraphInfoStore executionGraphInfoStore = createMemoryExecutionGraphInfoStore(Time.hours(1L), maxCapacity)) {
for (ExecutionGraphInfo executionGraphInfo : oldExecutionGraphInfos) {
executionGraphInfoStore.put(executionGraphInfo);
// no more than the configured maximum capacity
assertTrue(executionGraphInfoStore.size() <= maxCapacity);
}
for (ExecutionGraphInfo executionGraphInfo : newExecutionGraphInfos) {
executionGraphInfoStore.put(executionGraphInfo);
// equals to the configured maximum capacity
assertEquals(maxCapacity, executionGraphInfoStore.size());
}
// the older execution graphs are purged
assertThat(executionGraphInfoStore.getAvailableJobDetails(), Matchers.containsInAnyOrder(jobDetails.toArray()));
}
}
Aggregations