Search in sources :

Example 16 with TestingSchedulingExecutionVertex

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

the class RegionPartitionGroupReleaseStrategyTest method releasePartitionsIfDownstreamRegionIsFinished.

@Test
public void releasePartitionsIfDownstreamRegionIsFinished() {
    final List<TestingSchedulingExecutionVertex> producers = testingSchedulingTopology.addExecutionVertices().finish();
    final List<TestingSchedulingExecutionVertex> consumers = testingSchedulingTopology.addExecutionVertices().finish();
    final List<TestingSchedulingResultPartition> resultPartitions = testingSchedulingTopology.connectPointwise(producers, consumers).finish();
    final ExecutionVertexID onlyConsumerVertexId = consumers.get(0).getId();
    final IntermediateResultPartitionID onlyResultPartitionId = resultPartitions.get(0).getId();
    final RegionPartitionGroupReleaseStrategy regionPartitionGroupReleaseStrategy = new RegionPartitionGroupReleaseStrategy(testingSchedulingTopology);
    final List<IntermediateResultPartitionID> partitionsToRelease = getReleasablePartitions(regionPartitionGroupReleaseStrategy, onlyConsumerVertexId);
    assertThat(partitionsToRelease, contains(onlyResultPartitionId));
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingResultPartition(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) RegionPartitionGroupReleaseStrategy(org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) Test(org.junit.Test)

Example 17 with TestingSchedulingExecutionVertex

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

the class RestartPipelinedRegionFailoverStrategyTest method testRegionFailoverForDataConsumptionErrors.

/**
 * Tests for scenes that a task fails for data consumption error, in which case the region
 * containing the failed task, the region containing the unavailable result partition and all
 * their consumer regions should be restarted.
 *
 * <pre>
 *     (v1) -+-> (v4)
 *           x
 *     (v2) -+-> (v5)
 *
 *     (v3) -+-> (v6)
 *
 *           ^
 *           |
 *       (blocking)
 * </pre>
 *
 * Each vertex is in an individual region.
 */
@Test
public void testRegionFailoverForDataConsumptionErrors() throws Exception {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v4 = topology.newExecutionVertex(ExecutionState.RUNNING);
    TestingSchedulingExecutionVertex v5 = topology.newExecutionVertex(ExecutionState.RUNNING);
    TestingSchedulingExecutionVertex v6 = topology.newExecutionVertex(ExecutionState.RUNNING);
    topology.connect(v1, v4, ResultPartitionType.BLOCKING);
    topology.connect(v1, v5, ResultPartitionType.BLOCKING);
    topology.connect(v2, v4, ResultPartitionType.BLOCKING);
    topology.connect(v2, v5, ResultPartitionType.BLOCKING);
    topology.connect(v3, v6, ResultPartitionType.BLOCKING);
    RestartPipelinedRegionFailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology);
    Iterator<TestingSchedulingResultPartition> v4InputEdgeIterator = v4.getConsumedResults().iterator();
    TestingSchedulingResultPartition v1out = v4InputEdgeIterator.next();
    verifyThatFailedExecution(strategy, v4).partitionConnectionCause(v1out).restarts(v1, v4, v5);
    TestingSchedulingResultPartition v2out = v4InputEdgeIterator.next();
    verifyThatFailedExecution(strategy, v4).partitionConnectionCause(v2out).restarts(v2, v4, v5);
    Iterator<TestingSchedulingResultPartition> v5InputEdgeIterator = v5.getConsumedResults().iterator();
    v1out = v5InputEdgeIterator.next();
    verifyThatFailedExecution(strategy, v5).partitionConnectionCause(v1out).restarts(v1, v4, v5);
    v2out = v5InputEdgeIterator.next();
    verifyThatFailedExecution(strategy, v5).partitionConnectionCause(v2out).restarts(v2, v4, v5);
    TestingSchedulingResultPartition v3out = v6.getConsumedResults().iterator().next();
    verifyThatFailedExecution(strategy, v6).partitionConnectionCause(v3out).restarts(v3, v6);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingResultPartition(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 18 with TestingSchedulingExecutionVertex

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

the class RestartPipelinedRegionFailoverStrategyTest method testRegionFailoverForRegionInternalErrors.

/**
 * Tests for scenes that a task fails for its own error, in which case the region containing the
 * failed task and its consumer regions should be restarted.
 *
 * <pre>
 *     (v1) -+-> (v4)
 *           x
 *     (v2) -+-> (v5)
 *
 *     (v3) -+-> (v6)
 *
 *           ^
 *           |
 *       (blocking)
 * </pre>
 *
 * Each vertex is in an individual region.
 */
@Test
public void testRegionFailoverForRegionInternalErrors() {
    final TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v4 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v5 = topology.newExecutionVertex(ExecutionState.SCHEDULED);
    TestingSchedulingExecutionVertex v6 = topology.newExecutionVertex(ExecutionState.RUNNING);
    topology.connect(v1, v4, ResultPartitionType.BLOCKING);
    topology.connect(v1, v5, ResultPartitionType.BLOCKING);
    topology.connect(v2, v4, ResultPartitionType.BLOCKING);
    topology.connect(v2, v5, ResultPartitionType.BLOCKING);
    topology.connect(v3, v6, ResultPartitionType.BLOCKING);
    RestartPipelinedRegionFailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology);
    verifyThatFailedExecution(strategy, v1).restarts(v1, v4, v5);
    verifyThatFailedExecution(strategy, v2).restarts(v2, v4, v5);
    verifyThatFailedExecution(strategy, v3).restarts(v3, v6);
    verifyThatFailedExecution(strategy, v4).restarts(v4);
    verifyThatFailedExecution(strategy, v5).restarts(v5);
    verifyThatFailedExecution(strategy, v6).restarts(v6);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 19 with TestingSchedulingExecutionVertex

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

the class RestartPipelinedRegionFailoverStrategyTest method testRegionFailoverForMultipleVerticesRegions.

/**
 * Tests region failover scenes for topology with multiple vertices.
 *
 * <pre>
 *     (v1) ---> (v2) --|--> (v3) ---> (v4) --|--> (v5) ---> (v6)
 *
 *           ^          ^          ^          ^          ^
 *           |          |          |          |          |
 *     (pipelined) (blocking) (pipelined) (blocking) (pipelined)
 * </pre>
 *
 * Component 1: 1,2; component 2: 3,4; component 3: 5,6
 */
@Test
public void testRegionFailoverForMultipleVerticesRegions() throws Exception {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex(ExecutionState.RUNNING);
    TestingSchedulingExecutionVertex v4 = topology.newExecutionVertex(ExecutionState.RUNNING);
    TestingSchedulingExecutionVertex v5 = topology.newExecutionVertex(ExecutionState.FAILED);
    TestingSchedulingExecutionVertex v6 = topology.newExecutionVertex(ExecutionState.CANCELED);
    topology.connect(v1, v2, ResultPartitionType.PIPELINED);
    topology.connect(v2, v3, ResultPartitionType.BLOCKING);
    topology.connect(v3, v4, ResultPartitionType.PIPELINED);
    topology.connect(v4, v5, ResultPartitionType.BLOCKING);
    topology.connect(v5, v6, ResultPartitionType.PIPELINED);
    RestartPipelinedRegionFailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology);
    verifyThatFailedExecution(strategy, v3).restarts(v3, v4, v5, v6);
    TestingSchedulingResultPartition v2out = v3.getConsumedResults().iterator().next();
    verifyThatFailedExecution(strategy, v3).partitionConnectionCause(v2out).restarts(v1, v2, v3, v4, v5, v6);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingResultPartition(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 20 with TestingSchedulingExecutionVertex

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

the class RestartPipelinedRegionFailoverStrategyTest method testRegionFailoverForPipelinedApproximate.

/**
 * Tests approximate local recovery downstream failover .
 *
 * <pre>
 *     (v1) -----> (v2) -----> (v4)
 *      |                       ^
 *      |--------> (v3) --------|
 * </pre>
 */
@Test
public void testRegionFailoverForPipelinedApproximate() {
    final TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex(ExecutionState.RUNNING);
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex(ExecutionState.RUNNING);
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex(ExecutionState.RUNNING);
    TestingSchedulingExecutionVertex v4 = topology.newExecutionVertex(ExecutionState.RUNNING);
    topology.connect(v1, v2, ResultPartitionType.PIPELINED_APPROXIMATE);
    topology.connect(v1, v3, ResultPartitionType.PIPELINED_APPROXIMATE);
    topology.connect(v2, v4, ResultPartitionType.PIPELINED_APPROXIMATE);
    topology.connect(v3, v4, ResultPartitionType.PIPELINED_APPROXIMATE);
    RestartPipelinedRegionFailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology);
    verifyThatFailedExecution(strategy, v1).restarts(v1, v2, v3, v4);
    verifyThatFailedExecution(strategy, v2).restarts(v2, v4);
    verifyThatFailedExecution(strategy, v3).restarts(v3, v4);
    verifyThatFailedExecution(strategy, v4).restarts(v4);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Aggregations

TestingSchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex)27 Test (org.junit.Test)26 TestingSchedulingTopology (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology)21 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)15 Set (java.util.Set)11 SchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex)11 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)6 RegionPartitionGroupReleaseStrategy (org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy)5 TestingSchedulingResultPartition (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition)5 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)1 SlotSharingGroup (org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup)1 TestingSchedulingPipelinedRegion (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingPipelinedRegion)1