Search in sources :

Example 66 with TestingLogicalSlotBuilder

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

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 67 with TestingLogicalSlotBuilder

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

the class PartitionReleaseInBatchJobBenchmark method setup.

public void setup(JobConfiguration jobConfiguration) throws Exception {
    super.setup();
    final List<JobVertex> jobVertices = createDefaultJobVertices(jobConfiguration);
    executionGraph = createAndInitExecutionGraph(jobVertices, jobConfiguration, scheduledExecutorService);
    final JobVertex source = jobVertices.get(0);
    sink = jobVertices.get(1);
    final TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
    deployTasks(executionGraph, source.getID(), slotBuilder, true);
    transitionTaskStatus(executionGraph, source.getID(), ExecutionState.FINISHED);
    deployTasks(executionGraph, sink.getID(), slotBuilder, true);
}
Also used : JobVertex(org.apache.flink.runtime.jobgraph.JobVertex) TestingLogicalSlotBuilder(org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder)

Example 68 with TestingLogicalSlotBuilder

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

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)

Example 69 with TestingLogicalSlotBuilder

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

the class ExecutionVertexCancelTest method testCancelFromRunning.

@Test
public void testCancelFromRunning() {
    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();
        vertex.getCurrentExecutionAttempt().completeCancelling();
        assertEquals(ExecutionState.CANCELED, vertex.getExecutionState());
        assertFalse(slot.isAlive());
        assertFalse(vertex.getFailureInfo().isPresent());
        assertTrue(vertex.getStateTimestamp(ExecutionState.CREATED) > 0);
        assertTrue(vertex.getStateTimestamp(ExecutionState.CANCELING) > 0);
        assertTrue(vertex.getStateTimestamp(ExecutionState.CANCELED) > 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)

Example 70 with TestingLogicalSlotBuilder

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

the class ExecutionVertexDeploymentTest method testDeployFailedAsynchronously.

@Test
public void testDeployFailedAsynchronously() {
    try {
        final ExecutionVertex vertex = getExecutionVertex();
        final LogicalSlot slot = new TestingLogicalSlotBuilder().setTaskManagerGateway(new SubmitFailingSimpleAckingTaskManagerGateway()).createTestingLogicalSlot();
        assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
        vertex.getCurrentExecutionAttempt().transitionState(ExecutionState.SCHEDULED);
        vertex.deployToSlot(slot);
        // wait until the state transition must be done
        for (int i = 0; i < 100; i++) {
            if (vertex.getExecutionState() == ExecutionState.FAILED && vertex.getFailureInfo().isPresent()) {
                break;
            } else {
                Thread.sleep(10);
            }
        }
        assertEquals(ExecutionState.FAILED, vertex.getExecutionState());
        assertTrue(vertex.getFailureInfo().isPresent());
        assertThat(vertex.getFailureInfo().map(ErrorInfo::getExceptionAsString).get(), containsString(ERROR_MESSAGE));
        assertTrue(vertex.getStateTimestamp(ExecutionState.CREATED) > 0);
        assertTrue(vertex.getStateTimestamp(ExecutionState.DEPLOYING) > 0);
        assertTrue(vertex.getStateTimestamp(ExecutionState.FAILED) > 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) TestingLogicalSlot(org.apache.flink.runtime.jobmaster.TestingLogicalSlot) 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