Search in sources :

Example 16 with SchedulingExecutionVertex

use of org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex in project flink by apache.

the class SchedulingPipelinedRegionComputeUtilTest method testIndividualVertices.

/**
 * Tests that validates that a graph with single unconnected vertices works correctly.
 *
 * <pre>
 *     (v1)
 *
 *     (v2)
 *
 *     (v3)
 * </pre>
 */
@Test
public void testIndividualVertices() {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex();
    Map<ExecutionVertexID, Set<SchedulingExecutionVertex>> pipelinedRegionByVertex = computePipelinedRegionByVertex(topology);
    Set<SchedulingExecutionVertex> r1 = pipelinedRegionByVertex.get(v1.getId());
    Set<SchedulingExecutionVertex> r2 = pipelinedRegionByVertex.get(v2.getId());
    Set<SchedulingExecutionVertex> r3 = pipelinedRegionByVertex.get(v3.getId());
    assertDistinctRegions(r1, r2, r3);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) SchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex) Set(java.util.Set) TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 17 with SchedulingExecutionVertex

use of org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex in project flink by apache.

the class SchedulingPipelinedRegionComputeUtilTest method testCyclicDependentRegionsAreMerged.

/**
 * This test checks that cyclic dependent regions will be merged into one.
 *
 * <pre>
 *       (blocking)(blocking)
 *           |      |
 *           v      v
 *          +|-(v2)-|+
 *          |        |
 *     (v1)--+       +--(v4)
 *          |        |
 *          +--(v3)--+
 * </pre>
 */
@Test
public void testCyclicDependentRegionsAreMerged() {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v4 = topology.newExecutionVertex();
    topology.connect(v1, v2, ResultPartitionType.BLOCKING).connect(v1, v3, ResultPartitionType.PIPELINED).connect(v2, v4, ResultPartitionType.BLOCKING).connect(v3, v4, ResultPartitionType.PIPELINED);
    Map<ExecutionVertexID, Set<SchedulingExecutionVertex>> pipelinedRegionByVertex = computePipelinedRegionByVertex(topology);
    Set<SchedulingExecutionVertex> r1 = pipelinedRegionByVertex.get(v1.getId());
    Set<SchedulingExecutionVertex> r2 = pipelinedRegionByVertex.get(v2.getId());
    Set<SchedulingExecutionVertex> r3 = pipelinedRegionByVertex.get(v3.getId());
    Set<SchedulingExecutionVertex> r4 = pipelinedRegionByVertex.get(v4.getId());
    assertSameRegion(r1, r2, r3, r4);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) SchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex) Set(java.util.Set) TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 18 with SchedulingExecutionVertex

use of org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex in project flink by apache.

the class SchedulingPipelinedRegionComputeUtilTest method testOneComponentInstanceFromOneSource.

/**
 * Tests that validates that a single pipelined component instance from one source works
 * correctly.
 *
 * <pre>
 *                 +--(v4)
 *          +--(v2)-+
 *          |      +--(v5)
 *     (v1)--+
 *          |      +--(v6)
 *          +--(v3)-+
 *                 +--(v7)
 * </pre>
 */
@Test
public void testOneComponentInstanceFromOneSource() {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v4 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v5 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v6 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v7 = topology.newExecutionVertex();
    topology.connect(v1, v2, ResultPartitionType.PIPELINED).connect(v1, v3, ResultPartitionType.PIPELINED).connect(v2, v4, ResultPartitionType.PIPELINED).connect(v2, v5, ResultPartitionType.PIPELINED).connect(v3, v6, ResultPartitionType.PIPELINED).connect(v3, v7, ResultPartitionType.PIPELINED);
    Map<ExecutionVertexID, Set<SchedulingExecutionVertex>> pipelinedRegionByVertex = computePipelinedRegionByVertex(topology);
    Set<SchedulingExecutionVertex> r1 = pipelinedRegionByVertex.get(v1.getId());
    Set<SchedulingExecutionVertex> r2 = pipelinedRegionByVertex.get(v2.getId());
    Set<SchedulingExecutionVertex> r3 = pipelinedRegionByVertex.get(v3.getId());
    Set<SchedulingExecutionVertex> r4 = pipelinedRegionByVertex.get(v4.getId());
    Set<SchedulingExecutionVertex> r5 = pipelinedRegionByVertex.get(v5.getId());
    Set<SchedulingExecutionVertex> r6 = pipelinedRegionByVertex.get(v6.getId());
    Set<SchedulingExecutionVertex> r7 = pipelinedRegionByVertex.get(v7.getId());
    assertSameRegion(r1, r2, r3, r4, r5, r6, r7);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) SchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex) Set(java.util.Set) TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 19 with SchedulingExecutionVertex

use of org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex in project flink by apache.

the class DefaultSchedulerTest method vertexIsNotAffectedByOutdatedDeployment.

@Test
public void vertexIsNotAffectedByOutdatedDeployment() {
    final JobGraph jobGraph = singleJobVertexJobGraph(2);
    testExecutionSlotAllocator.disableAutoCompletePendingRequests();
    final DefaultScheduler scheduler = createSchedulerAndStartScheduling(jobGraph);
    final Iterator<ArchivedExecutionVertex> vertexIterator = scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices().iterator();
    final ArchivedExecutionVertex v1 = vertexIterator.next();
    final ArchivedExecutionVertex v2 = vertexIterator.next();
    final SchedulingExecutionVertex sv1 = scheduler.getSchedulingTopology().getVertices().iterator().next();
    // fail v1 and let it recover to SCHEDULED
    // the initial deployment of v1 will be outdated
    scheduler.updateTaskExecutionState(createFailedTaskExecutionState(v1.getCurrentExecutionAttempt().getAttemptId()));
    taskRestartExecutor.triggerScheduledTasks();
    // fail v2 to get all pending slot requests in the initial deployments to be done
    // this triggers the outdated deployment of v1
    scheduler.updateTaskExecutionState(createFailedTaskExecutionState(v2.getCurrentExecutionAttempt().getAttemptId()));
    // v1 should not be affected
    assertThat(sv1.getState(), is(equalTo(ExecutionState.SCHEDULED)));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) SchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex) ArchivedExecutionVertex(org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex) AdaptiveSchedulerTest(org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest) Test(org.junit.Test)

Aggregations

SchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex)19 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)15 Set (java.util.Set)13 Test (org.junit.Test)13 TestingSchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex)11 TestingSchedulingTopology (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology)11 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)3 IdentityHashMap (java.util.IdentityHashMap)2 List (java.util.List)2 ArchivedExecutionVertex (org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex)2 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)2 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)2 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)2 ConsumerVertexGroup (org.apache.flink.runtime.scheduler.strategy.ConsumerVertexGroup)2 SchedulingResultPartition (org.apache.flink.runtime.scheduler.strategy.SchedulingResultPartition)2 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Objects (java.util.Objects)1