Search in sources :

Example 11 with ExecutionGraphInfo

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()));
    }
}
Also used : ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) ExecutionGraphInfoStoreTestUtils.generateJobDetails(org.apache.flink.runtime.dispatcher.ExecutionGraphInfoStoreTestUtils.generateJobDetails) JobDetails(org.apache.flink.runtime.messages.webmonitor.JobDetails) Test(org.junit.Test)

Example 12 with ExecutionGraphInfo

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));
    }
}
Also used : ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) Test(org.junit.Test)

Example 13 with ExecutionGraphInfo

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);
}
Also used : ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) Test(org.junit.Test)

Example 14 with ExecutionGraphInfo

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)));
}
Also used : ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) SerializedThrowable(org.apache.flink.util.SerializedThrowable) EmptyRequestBody(org.apache.flink.runtime.rest.messages.EmptyRequestBody) JobExceptionsInfoWithHistory(org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory) Test(org.junit.Test)

Example 15 with ExecutionGraphInfo

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);
    }
}
Also used : FlinkException(org.apache.flink.util.FlinkException) Arrays(java.util.Arrays) BeforeClass(org.junit.BeforeClass) CompletableFuture(java.util.concurrent.CompletableFuture) TestingRestfulGateway(org.apache.flink.runtime.webmonitor.TestingRestfulGateway) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Assert.assertThat(org.junit.Assert.assertThat) FutureUtils(org.apache.flink.util.concurrent.FutureUtils) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) TestLogger(org.apache.flink.util.TestLogger) Assert.fail(org.junit.Assert.fail) ExecutorService(java.util.concurrent.ExecutorService) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) Collection(java.util.Collection) Matchers(org.hamcrest.Matchers) Assert.assertTrue(org.junit.Assert.assertTrue) RestfulGateway(org.apache.flink.runtime.webmonitor.RestfulGateway) Test(org.junit.Test) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) Preconditions(org.apache.flink.util.Preconditions) ExecutorUtils(org.apache.flink.util.ExecutorUtils) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) JobID(org.apache.flink.api.common.JobID) FlinkJobNotFoundException(org.apache.flink.runtime.messages.FlinkJobNotFoundException) Time(org.apache.flink.api.common.time.Time) Assert.assertEquals(org.junit.Assert.assertEquals) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) Time(org.apache.flink.api.common.time.Time) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) JobID(org.apache.flink.api.common.JobID) TestingRestfulGateway(org.apache.flink.runtime.webmonitor.TestingRestfulGateway) Test(org.junit.Test)

Aggregations

ExecutionGraphInfo (org.apache.flink.runtime.scheduler.ExecutionGraphInfo)45 Test (org.junit.Test)33 ArchivedExecutionGraphBuilder (org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder)23 Time (org.apache.flink.api.common.time.Time)12 CompletableFuture (java.util.concurrent.CompletableFuture)11 JobID (org.apache.flink.api.common.JobID)11 JobStatus (org.apache.flink.api.common.JobStatus)9 FlinkException (org.apache.flink.util.FlinkException)8 File (java.io.File)7 TestingJobManagerRunner (org.apache.flink.runtime.jobmaster.TestingJobManagerRunner)7 ArrayList (java.util.ArrayList)6 ArchivedExecutionGraph (org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph)6 FlinkJobNotFoundException (org.apache.flink.runtime.messages.FlinkJobNotFoundException)6 EmptyRequestBody (org.apache.flink.runtime.rest.messages.EmptyRequestBody)6 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)5 JobManagerRunner (org.apache.flink.runtime.jobmaster.JobManagerRunner)5 Acknowledge (org.apache.flink.runtime.messages.Acknowledge)5 JobExceptionsInfoWithHistory (org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory)5 RootExceptionHistoryEntry (org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry)5 ExceptionUtils (org.apache.flink.util.ExceptionUtils)5