Search in sources :

Example 1 with DeclarativeSlotPoolBridge

use of org.apache.flink.runtime.jobmaster.slotpool.DeclarativeSlotPoolBridge in project flink by apache.

the class ExecutionGraphRestartTest method testCancelAllPendingRequestWhileCanceling.

@Test
public void testCancelAllPendingRequestWhileCanceling() throws Exception {
    try (DeclarativeSlotPoolBridge slotPool = SlotPoolUtils.createDeclarativeSlotPoolBridge()) {
        final int numTasksExceedSlotPool = 50;
        // create a graph with task count larger than slot pool
        JobVertex sender = ExecutionGraphTestUtils.createJobVertex("Task", NUM_TASKS + numTasksExceedSlotPool, NoOpInvokable.class);
        JobGraph graph = JobGraphTestUtils.streamingJobGraph(sender);
        SchedulerBase scheduler = SchedulerTestingUtils.newSchedulerBuilder(graph, mainThreadExecutor).setExecutionSlotAllocatorFactory(createExecutionSlotAllocatorFactory(slotPool)).build();
        ExecutionGraph executionGraph = scheduler.getExecutionGraph();
        startScheduling(scheduler);
        offerSlots(slotPool, NUM_TASKS);
        assertEquals(numTasksExceedSlotPool, slotPool.getNumPendingRequests());
        scheduler.cancel();
        assertEquals(JobStatus.CANCELLING, executionGraph.getState());
        assertEquals(0, slotPool.getNumPendingRequests());
    }
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) JobVertex(org.apache.flink.runtime.jobgraph.JobVertex) DeclarativeSlotPoolBridge(org.apache.flink.runtime.jobmaster.slotpool.DeclarativeSlotPoolBridge) SchedulerBase(org.apache.flink.runtime.scheduler.SchedulerBase) Test(org.junit.Test)

Example 2 with DeclarativeSlotPoolBridge

use of org.apache.flink.runtime.jobmaster.slotpool.DeclarativeSlotPoolBridge in project flink by apache.

the class ExecutionGraphRestartTest method testCancelAllPendingRequestWhileFailing.

@Test
public void testCancelAllPendingRequestWhileFailing() throws Exception {
    try (DeclarativeSlotPoolBridge slotPool = SlotPoolUtils.createDeclarativeSlotPoolBridge()) {
        final int numTasksExceedSlotPool = 50;
        // create a graph with task count larger than slot pool
        JobVertex sender = ExecutionGraphTestUtils.createJobVertex("Task", NUM_TASKS + numTasksExceedSlotPool, NoOpInvokable.class);
        JobGraph graph = JobGraphTestUtils.streamingJobGraph(sender);
        SchedulerBase scheduler = SchedulerTestingUtils.newSchedulerBuilder(graph, mainThreadExecutor).setExecutionSlotAllocatorFactory(createExecutionSlotAllocatorFactory(slotPool)).build();
        ExecutionGraph executionGraph = scheduler.getExecutionGraph();
        startScheduling(scheduler);
        offerSlots(slotPool, NUM_TASKS);
        assertEquals(numTasksExceedSlotPool, slotPool.getNumPendingRequests());
        scheduler.handleGlobalFailure(new Exception("test"));
        assertEquals(JobStatus.FAILING, executionGraph.getState());
        assertEquals(0, slotPool.getNumPendingRequests());
    }
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) JobVertex(org.apache.flink.runtime.jobgraph.JobVertex) DeclarativeSlotPoolBridge(org.apache.flink.runtime.jobmaster.slotpool.DeclarativeSlotPoolBridge) SchedulerBase(org.apache.flink.runtime.scheduler.SchedulerBase) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)2 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)2 DeclarativeSlotPoolBridge (org.apache.flink.runtime.jobmaster.slotpool.DeclarativeSlotPoolBridge)2 SchedulerBase (org.apache.flink.runtime.scheduler.SchedulerBase)2 Test (org.junit.Test)2 IOException (java.io.IOException)1