Search in sources :

Example 21 with TestingJobManagerRunner

use of org.apache.flink.runtime.jobmaster.TestingJobManagerRunner in project flink by apache.

the class MiniDispatcherTest method testTerminationAfterJobCompletion.

/**
 * Tests that in detached mode, the {@link MiniDispatcher} will complete the future that signals
 * job termination.
 */
@Test
public void testTerminationAfterJobCompletion() throws Exception {
    final MiniDispatcher miniDispatcher = createMiniDispatcher(ClusterEntrypoint.ExecutionMode.DETACHED);
    miniDispatcher.start();
    try {
        // wait until we have submitted the job
        final TestingJobManagerRunner testingJobManagerRunner = testingJobManagerRunnerFactory.takeCreatedJobManagerRunner();
        testingJobManagerRunner.completeResultFuture(executionGraphInfo);
        // wait until we terminate
        miniDispatcher.getShutDownFuture().get();
    } finally {
        RpcUtils.terminateRpcEndpoint(miniDispatcher, timeout);
    }
}
Also used : TestingJobManagerRunner(org.apache.flink.runtime.jobmaster.TestingJobManagerRunner) Test(org.junit.Test)

Example 22 with TestingJobManagerRunner

use of org.apache.flink.runtime.jobmaster.TestingJobManagerRunner in project flink by apache.

the class TestingJobManagerRunnerFactory method offerTestingJobManagerRunner.

protected TestingJobManagerRunner offerTestingJobManagerRunner(JobID jobId) {
    final TestingJobManagerRunner testingJobManagerRunner = createTestingJobManagerRunner(jobId);
    Preconditions.checkState(createdJobManagerRunner.offer(testingJobManagerRunner), "Unable to persist created the new runner.");
    return testingJobManagerRunner;
}
Also used : TestingJobManagerRunner(org.apache.flink.runtime.jobmaster.TestingJobManagerRunner)

Aggregations

TestingJobManagerRunner (org.apache.flink.runtime.jobmaster.TestingJobManagerRunner)22 Test (org.junit.Test)16 ExecutionGraphInfo (org.apache.flink.runtime.scheduler.ExecutionGraphInfo)7 ArchivedExecutionGraphBuilder (org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder)5 JobID (org.apache.flink.api.common.JobID)4 FlinkException (org.apache.flink.util.FlinkException)4 ArrayDeque (java.util.ArrayDeque)3 TimeoutException (java.util.concurrent.TimeoutException)3 OneShotLatch (org.apache.flink.core.testutils.OneShotLatch)3 ArchivedExecutionGraph (org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph)3 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)3 JobManagerRunner (org.apache.flink.runtime.jobmaster.JobManagerRunner)3 Test (org.junit.jupiter.api.Test)3 IOException (java.io.IOException)2 Arrays (java.util.Arrays)2 Optional (java.util.Optional)2 Queue (java.util.Queue)2 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 ExecutionException (java.util.concurrent.ExecutionException)2