use of org.apache.flink.runtime.testutils.TestingJobGraphStore in project flink by apache.
the class DispatcherTest method testOnRemovedJobGraphDoesNotCleanUpHAFiles.
@Test
public void testOnRemovedJobGraphDoesNotCleanUpHAFiles() throws Exception {
final CompletableFuture<JobID> removeJobGraphFuture = new CompletableFuture<>();
final CompletableFuture<JobID> releaseJobGraphFuture = new CompletableFuture<>();
final TestingJobGraphStore testingJobGraphStore = TestingJobGraphStore.newBuilder().setGlobalCleanupFunction((jobId, executor) -> {
removeJobGraphFuture.complete(jobId);
return FutureUtils.completedVoidFuture();
}).setLocalCleanupFunction((jobId, executor) -> {
releaseJobGraphFuture.complete(jobId);
return FutureUtils.completedVoidFuture();
}).build();
testingJobGraphStore.start(null);
dispatcher = createTestingDispatcherBuilder().setRecoveredJobs(Collections.singleton(jobGraph)).setJobGraphWriter(testingJobGraphStore).build();
dispatcher.start();
final CompletableFuture<Void> processFuture = dispatcher.onRemovedJobGraph(jobGraph.getJobID());
processFuture.join();
assertThat(releaseJobGraphFuture.get(), is(jobGraph.getJobID()));
try {
removeJobGraphFuture.get(10L, TimeUnit.MILLISECONDS);
fail("onRemovedJobGraph should not remove the job from the JobGraphStore.");
} catch (TimeoutException expected) {
}
}
use of org.apache.flink.runtime.testutils.TestingJobGraphStore in project flink by apache.
the class DispatcherTest method testPersistedJobGraphWhenDispatcherIsShutDown.
@Test
public void testPersistedJobGraphWhenDispatcherIsShutDown() throws Exception {
final TestingJobGraphStore submittedJobGraphStore = TestingJobGraphStore.newBuilder().build();
submittedJobGraphStore.start(null);
haServices.setJobGraphStore(submittedJobGraphStore);
dispatcher = createTestingDispatcherBuilder().setJobGraphWriter(submittedJobGraphStore).build();
dispatcher.start();
final DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class);
dispatcherGateway.submitJob(jobGraph, TIMEOUT).get();
assertThat(dispatcher.getNumberJobs(TIMEOUT).get(), Matchers.is(1));
dispatcher.close();
assertThat(submittedJobGraphStore.contains(jobGraph.getJobID()), Matchers.is(true));
}
use of org.apache.flink.runtime.testutils.TestingJobGraphStore in project flink by apache.
the class DispatcherResourceCleanerFactoryTest method createJobGraphWriter.
private JobGraphWriter createJobGraphWriter() throws Exception {
jobGraphWriterLocalCleanupFuture = new CompletableFuture<>();
jobGraphWriterGlobalCleanupFuture = new CompletableFuture<>();
final TestingJobGraphStore jobGraphStore = TestingJobGraphStore.newBuilder().setGlobalCleanupFunction((jobId, executor) -> {
jobGraphWriterGlobalCleanupFuture.complete(jobId);
return FutureUtils.completedVoidFuture();
}).setLocalCleanupFunction((jobId, ignoredExecutor) -> {
jobGraphWriterLocalCleanupFuture.complete(jobId);
return FutureUtils.completedVoidFuture();
}).build();
jobGraphStore.start(null);
return jobGraphStore;
}
Aggregations