Search in sources :

Example 6 with TestingLogicalSlotBuilder

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

the class RegionToRestartInStreamingJobBenchmark method setup.

@Override
public void setup(JobConfiguration jobConfiguration) throws Exception {
    super.setup(jobConfiguration);
    TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
    deployAllTasks(executionGraph, slotBuilder);
    switchAllVerticesToRunning(executionGraph);
}
Also used : TestingLogicalSlotBuilder(org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder)

Example 7 with TestingLogicalSlotBuilder

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

the class RootExceptionHistoryEntryTest method extractExecutionVertex.

private ExecutionVertex extractExecutionVertex(int pos) {
    final ExecutionVertex executionVertex = Iterables.get(executionGraph.getAllExecutionVertices(), pos);
    executionVertex.tryAssignResource(new TestingLogicalSlotBuilder().createTestingLogicalSlot());
    return executionVertex;
}
Also used : TestingLogicalSlotBuilder(org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex)

Example 8 with TestingLogicalSlotBuilder

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

the class DeployingTasksBenchmarkBase method setup.

public void setup(JobConfiguration jobConfiguration) throws Exception {
    super.setup();
    jobVertices = createDefaultJobVertices(jobConfiguration);
    executionGraph = createAndInitExecutionGraph(jobVertices, jobConfiguration, scheduledExecutorService);
    final TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
    for (ExecutionJobVertex ejv : executionGraph.getVerticesTopologically()) {
        for (ExecutionVertex ev : ejv.getTaskVertices()) {
            final LogicalSlot slot = slotBuilder.createTestingLogicalSlot();
            final Execution execution = ev.getCurrentExecutionAttempt();
            execution.registerProducedPartitions(slot.getTaskManagerLocation(), true).get();
            if (!execution.tryAssignResource(slot)) {
                throw new RuntimeException("Error when assigning slot to execution.");
            }
        }
    }
}
Also used : Execution(org.apache.flink.runtime.executiongraph.Execution) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) TestingLogicalSlotBuilder(org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) LogicalSlot(org.apache.flink.runtime.jobmaster.LogicalSlot)

Example 9 with TestingLogicalSlotBuilder

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

the class SharedSlotTest method testReturnLogicalSlotRejectsUnknownSlot.

@Test(expected = IllegalStateException.class)
public void testReturnLogicalSlotRejectsUnknownSlot() {
    final TestingPhysicalSlot physicalSlot = TestingPhysicalSlot.builder().build();
    final SharedSlot sharedSlot = new SharedSlot(new SlotRequestId(), physicalSlot, false, () -> {
    });
    final LogicalSlot logicalSlot = new TestingLogicalSlotBuilder().createTestingLogicalSlot();
    logicalSlot.releaseSlot(new Exception("test"));
    sharedSlot.returnLogicalSlot(logicalSlot);
}
Also used : SlotRequestId(org.apache.flink.runtime.jobmaster.SlotRequestId) TestingPhysicalSlot(org.apache.flink.runtime.scheduler.TestingPhysicalSlot) TestingLogicalSlotBuilder(org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder) LogicalSlot(org.apache.flink.runtime.jobmaster.LogicalSlot) Test(org.junit.Test)

Example 10 with TestingLogicalSlotBuilder

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

the class ExecutionVertexCancelTest method testCancelFromRunningDidNotFindTask.

@Test
public void testCancelFromRunningDidNotFindTask() {
    // this may happen when the task finished or failed while the call was in progress
    try {
        final ExecutionVertex vertex = getExecutionVertex();
        LogicalSlot slot = new TestingLogicalSlotBuilder().setTaskManagerGateway(new CancelSequenceSimpleAckingTaskManagerGateway(1)).createTestingLogicalSlot();
        setVertexResource(vertex, slot);
        setVertexState(vertex, ExecutionState.RUNNING);
        assertEquals(ExecutionState.RUNNING, vertex.getExecutionState());
        vertex.cancel();
        assertEquals(ExecutionState.CANCELING, vertex.getExecutionState());
        assertFalse(vertex.getFailureInfo().isPresent());
        assertTrue(vertex.getStateTimestamp(ExecutionState.CREATED) > 0);
        assertTrue(vertex.getStateTimestamp(ExecutionState.CANCELING) > 0);
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : TestingLogicalSlotBuilder(org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder) ExecutionGraphTestUtils.getExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionGraphTestUtils.getExecutionVertex) LogicalSlot(org.apache.flink.runtime.jobmaster.LogicalSlot) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

TestingLogicalSlotBuilder (org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder)78 Test (org.junit.Test)57 LogicalSlot (org.apache.flink.runtime.jobmaster.LogicalSlot)48 ExecutionGraphTestUtils.getExecutionVertex (org.apache.flink.runtime.executiongraph.ExecutionGraphTestUtils.getExecutionVertex)30 ExecutionVertex (org.apache.flink.runtime.executiongraph.ExecutionVertex)21 TestingLogicalSlot (org.apache.flink.runtime.jobmaster.TestingLogicalSlot)21 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)18 IOException (java.io.IOException)15 SimpleAckingTaskManagerGateway (org.apache.flink.runtime.executiongraph.utils.SimpleAckingTaskManagerGateway)12 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)12 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)12 TaskManagerLocation (org.apache.flink.runtime.taskmanager.TaskManagerLocation)12 ArrayList (java.util.ArrayList)9 JobID (org.apache.flink.api.common.JobID)9 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)9 ExecutionGraph (org.apache.flink.runtime.executiongraph.ExecutionGraph)9 LocalTaskManagerLocation (org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation)9 List (java.util.List)6 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)6 CompletableFuture (java.util.concurrent.CompletableFuture)6