Search in sources :

Example 6 with ExecutionGraphInfo

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();
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) JobManagerRunnerResult(org.apache.flink.runtime.jobmaster.JobManagerRunnerResult) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 7 with ExecutionGraphInfo

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

Example 8 with ExecutionGraphInfo

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

Example 9 with ExecutionGraphInfo

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());
}
Also used : VoidBlobStore(org.apache.flink.runtime.blob.VoidBlobStore) Configuration(org.apache.flink.configuration.Configuration) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) TestingRpcService(org.apache.flink.runtime.rpc.TestingRpcService) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) BlobServer(org.apache.flink.runtime.blob.BlobServer) BeforeClass(org.junit.BeforeClass)

Example 10 with ExecutionGraphInfo

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()));
    }
}
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)

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