use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class JobExceptionsHandlerTest method testWithLocalExceptionHistoryEntryNotHavingATaskManagerInformationAvailable.
@Test
public void testWithLocalExceptionHistoryEntryNotHavingATaskManagerInformationAvailable() throws HandlerRequestException {
final RootExceptionHistoryEntry failure = new RootExceptionHistoryEntry(new RuntimeException("exception #1"), System.currentTimeMillis(), "task name", null, Collections.emptySet());
final ExecutionGraphInfo executionGraphInfo = createExecutionGraphInfo(failure);
final HandlerRequest<EmptyRequestBody> request = createRequest(executionGraphInfo.getJobId(), 10);
final JobExceptionsInfoWithHistory response = testInstance.handleRequest(request, executionGraphInfo);
assertThat(response.getExceptionHistory().getEntries(), contains(historyContainsJobExceptionInfo(failure.getException(), failure.getTimestamp(), failure.getFailingTaskName(), JobExceptionsHandler.toString(failure.getTaskManagerLocation()))));
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class DefaultExecutionGraphCacheTest method testConcurrentAccess.
/**
* Tests that concurrent accesses only trigger a single AccessExecutionGraph request.
*/
@Test
public void testConcurrentAccess() throws Exception {
final Time timeout = Time.milliseconds(100L);
final Time timeToLive = Time.hours(1L);
final CountingRestfulGateway restfulGateway = createCountingRestfulGateway(expectedJobId, CompletableFuture.completedFuture(expectedExecutionGraphInfo));
final int numConcurrentAccesses = 10;
final ArrayList<CompletableFuture<ExecutionGraphInfo>> executionGraphFutures = new ArrayList<>(numConcurrentAccesses);
final ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(numConcurrentAccesses);
try (ExecutionGraphCache executionGraphCache = new DefaultExecutionGraphCache(timeout, timeToLive)) {
for (int i = 0; i < numConcurrentAccesses; i++) {
CompletableFuture<ExecutionGraphInfo> executionGraphFuture = CompletableFuture.supplyAsync(() -> executionGraphCache.getExecutionGraphInfo(expectedJobId, restfulGateway), executor).thenCompose(Function.identity());
executionGraphFutures.add(executionGraphFuture);
}
final CompletableFuture<Collection<ExecutionGraphInfo>> allExecutionGraphFutures = FutureUtils.combineAll(executionGraphFutures);
Collection<ExecutionGraphInfo> allExecutionGraphs = allExecutionGraphFutures.get();
for (ExecutionGraphInfo executionGraph : allExecutionGraphs) {
assertEquals(expectedExecutionGraphInfo, executionGraph);
}
assertThat(restfulGateway.getNumRequestJobCalls(), Matchers.equalTo(1));
} finally {
ExecutorUtils.gracefulShutdown(5000L, TimeUnit.MILLISECONDS, executor);
}
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class DefaultExecutionGraphCacheTest method testExecutionGraphCaching.
/**
* Tests that we can cache AccessExecutionGraphs over multiple accesses.
*/
@Test
public void testExecutionGraphCaching() throws Exception {
final Time timeout = Time.milliseconds(100L);
final Time timeToLive = Time.hours(1L);
final CountingRestfulGateway restfulGateway = createCountingRestfulGateway(expectedJobId, CompletableFuture.completedFuture(expectedExecutionGraphInfo));
try (ExecutionGraphCache executionGraphCache = new DefaultExecutionGraphCache(timeout, timeToLive)) {
CompletableFuture<ExecutionGraphInfo> executionGraphInfoFuture = executionGraphCache.getExecutionGraphInfo(expectedJobId, restfulGateway);
assertEquals(expectedExecutionGraphInfo, executionGraphInfoFuture.get());
executionGraphInfoFuture = executionGraphCache.getExecutionGraphInfo(expectedJobId, restfulGateway);
assertEquals(expectedExecutionGraphInfo, executionGraphInfoFuture.get());
assertThat(restfulGateway.getNumRequestJobCalls(), Matchers.equalTo(1));
}
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class DefaultExecutionGraphCacheTest method testExecutionGraphEntryInvalidation.
/**
* Tests that an AccessExecutionGraph is invalidated after its TTL expired.
*/
@Test
public void testExecutionGraphEntryInvalidation() throws Exception {
final Time timeout = Time.milliseconds(100L);
final Time timeToLive = Time.milliseconds(1L);
final CountingRestfulGateway restfulGateway = createCountingRestfulGateway(expectedJobId, CompletableFuture.completedFuture(expectedExecutionGraphInfo), CompletableFuture.completedFuture(expectedExecutionGraphInfo));
try (ExecutionGraphCache executionGraphCache = new DefaultExecutionGraphCache(timeout, timeToLive)) {
CompletableFuture<ExecutionGraphInfo> executionGraphInfoFuture = executionGraphCache.getExecutionGraphInfo(expectedJobId, restfulGateway);
assertEquals(expectedExecutionGraphInfo, executionGraphInfoFuture.get());
// sleep for the TTL
Thread.sleep(timeToLive.toMilliseconds() * 5L);
CompletableFuture<ExecutionGraphInfo> executionGraphInfoFuture2 = executionGraphCache.getExecutionGraphInfo(expectedJobId, restfulGateway);
assertEquals(expectedExecutionGraphInfo, executionGraphInfoFuture2.get());
assertThat(restfulGateway.getNumRequestJobCalls(), Matchers.equalTo(2));
}
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class Dispatcher method submitFailedJob.
@Override
public CompletableFuture<Acknowledge> submitFailedJob(JobID jobId, String jobName, Throwable exception) {
final ArchivedExecutionGraph archivedExecutionGraph = ArchivedExecutionGraph.createSparseArchivedExecutionGraph(jobId, jobName, JobStatus.FAILED, exception, null, System.currentTimeMillis());
archiveExecutionGraph(new ExecutionGraphInfo(archivedExecutionGraph));
return CompletableFuture.completedFuture(Acknowledge.get());
}
Aggregations