use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class MemoryExecutionGraphInfoStoreTest method testAvailableJobDetails.
/**
* Tests that we obtain the correct collection of available job details.
*/
@Test
public void testAvailableJobDetails() throws IOException {
final int numberExecutionGraphs = 10;
final Collection<ExecutionGraphInfo> executionGraphInfos = generateTerminalExecutionGraphInfos(numberExecutionGraphs);
final Collection<JobDetails> jobDetails = generateJobDetails(executionGraphInfos);
try (final MemoryExecutionGraphInfoStore executionGraphInfoStore = createMemoryExecutionGraphInfoStore()) {
for (ExecutionGraphInfo executionGraphInfo : executionGraphInfos) {
executionGraphInfoStore.put(executionGraphInfo);
}
assertThat(executionGraphInfoStore.getAvailableJobDetails(), Matchers.containsInAnyOrder(jobDetails.toArray()));
}
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class MemoryExecutionGraphInfoStoreTest method testCloseCleansUp.
/**
* Tests that all job graphs are cleaned up after closing the store.
*/
@Test
public void testCloseCleansUp() throws IOException {
try (final MemoryExecutionGraphInfoStore executionGraphInfoStore = createMemoryExecutionGraphInfoStore()) {
assertThat(executionGraphInfoStore.size(), Matchers.equalTo(0));
executionGraphInfoStore.put(new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setState(JobStatus.FINISHED).build()));
assertThat(executionGraphInfoStore.size(), Matchers.equalTo(1));
executionGraphInfoStore.close();
assertThat(executionGraphInfoStore.size(), Matchers.equalTo(0));
}
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class JobExceptionsHandlerTest method testGetJobExceptionsInfo.
@Test
public void testGetJobExceptionsInfo() throws HandlerRequestException {
final int numExceptions = 20;
final ExecutionGraphInfo archivedExecutionGraph = createAccessExecutionGraph(numExceptions);
checkExceptionLimit(testInstance, archivedExecutionGraph, numExceptions, 10);
checkExceptionLimit(testInstance, archivedExecutionGraph, numExceptions, numExceptions);
checkExceptionLimit(testInstance, archivedExecutionGraph, numExceptions, 30);
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class JobExceptionsHandlerTest method testOnlyRootCause.
@Test
public void testOnlyRootCause() throws HandlerRequestException {
final Throwable rootCause = new RuntimeException("root cause");
final long rootCauseTimestamp = System.currentTimeMillis();
final ExecutionGraphInfo executionGraphInfo = createExecutionGraphInfo(fromGlobalFailure(rootCause, rootCauseTimestamp));
final HandlerRequest<EmptyRequestBody> request = createRequest(executionGraphInfo.getJobId(), 10);
final JobExceptionsInfoWithHistory response = testInstance.handleRequest(request, executionGraphInfo);
assertThat(response.getRootException(), is(ExceptionUtils.stringifyException(rootCause)));
assertThat(response.getRootTimestamp(), is(rootCauseTimestamp));
assertFalse(response.isTruncated());
assertThat(response.getAllExceptions(), empty());
assertThat(response.getExceptionHistory().getEntries(), contains(historyContainsGlobalFailure(rootCause, rootCauseTimestamp)));
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class DefaultExecutionGraphCacheTest method testCacheEntryCleanup.
/**
* Tests that cache entries are cleaned up when their TTL has expired upon calling {@link
* DefaultExecutionGraphCache#cleanup()}.
*/
@Test
public void testCacheEntryCleanup() throws Exception {
final Time timeout = Time.milliseconds(100L);
final Time timeToLive = Time.milliseconds(1L);
final JobID expectedJobId2 = new JobID();
final ExecutionGraphInfo expectedExecutionGraphInfo2 = new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().build());
final AtomicInteger requestJobCalls = new AtomicInteger(0);
final TestingRestfulGateway restfulGateway = new TestingRestfulGateway.Builder().setRequestExecutionGraphInfoFunction(jobId -> {
requestJobCalls.incrementAndGet();
if (jobId.equals(expectedJobId)) {
return CompletableFuture.completedFuture(expectedExecutionGraphInfo);
} else if (jobId.equals(expectedJobId2)) {
return CompletableFuture.completedFuture(expectedExecutionGraphInfo2);
} else {
throw new AssertionError("Invalid job id received.");
}
}).build();
try (ExecutionGraphCache executionGraphCache = new DefaultExecutionGraphCache(timeout, timeToLive)) {
CompletableFuture<ExecutionGraphInfo> executionGraph1Future = executionGraphCache.getExecutionGraphInfo(expectedJobId, restfulGateway);
CompletableFuture<ExecutionGraphInfo> executionGraph2Future = executionGraphCache.getExecutionGraphInfo(expectedJobId2, restfulGateway);
assertEquals(expectedExecutionGraphInfo, executionGraph1Future.get());
assertEquals(expectedExecutionGraphInfo2, executionGraph2Future.get());
assertThat(requestJobCalls.get(), Matchers.equalTo(2));
Thread.sleep(timeToLive.toMilliseconds());
executionGraphCache.cleanup();
assertTrue(executionGraphCache.size() == 0);
}
}
Aggregations