Search in sources :

Example 1 with TestingSchedulingResultPartition

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

the class RestartPipelinedRegionFailoverStrategyTest method testRegionFailoverDoesNotRestartCreatedExecutions.

/**
 * Tests region failover does not restart vertexes which are already in initial CREATED state.
 *
 * <pre>
 *     (v1) --|--> (v2)
 *
 *            ^
 *            |
 *       (blocking)
 * </pre>
 *
 * Component 1: 1; component 2: 2
 */
@Test
public void testRegionFailoverDoesNotRestartCreatedExecutions() {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex(ExecutionState.CREATED);
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex(ExecutionState.CREATED);
    topology.connect(v1, v2, ResultPartitionType.BLOCKING);
    FailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology);
    verifyThatFailedExecution(strategy, v2).restarts();
    TestingSchedulingResultPartition v1out = v2.getConsumedResults().iterator().next();
    verifyThatFailedExecution(strategy, v2).partitionConnectionCause(v1out).restarts();
}
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 2 with TestingSchedulingResultPartition

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

the class RegionPartitionGroupReleaseStrategyTest method releasePartitionsIfDownstreamRegionWithMultipleOperatorsIsFinished.

@Test
public void releasePartitionsIfDownstreamRegionWithMultipleOperatorsIsFinished() {
    final List<TestingSchedulingExecutionVertex> sourceVertices = testingSchedulingTopology.addExecutionVertices().finish();
    final List<TestingSchedulingExecutionVertex> intermediateVertices = testingSchedulingTopology.addExecutionVertices().finish();
    final List<TestingSchedulingExecutionVertex> sinkVertices = testingSchedulingTopology.addExecutionVertices().finish();
    final List<TestingSchedulingResultPartition> sourceResultPartitions = testingSchedulingTopology.connectAllToAll(sourceVertices, intermediateVertices).finish();
    testingSchedulingTopology.connectAllToAll(intermediateVertices, sinkVertices).withResultPartitionType(ResultPartitionType.PIPELINED).finish();
    final ExecutionVertexID onlyIntermediateVertexId = intermediateVertices.get(0).getId();
    final ExecutionVertexID onlySinkVertexId = sinkVertices.get(0).getId();
    final IntermediateResultPartitionID onlySourceResultPartitionId = sourceResultPartitions.get(0).getId();
    final RegionPartitionGroupReleaseStrategy regionPartitionGroupReleaseStrategy = new RegionPartitionGroupReleaseStrategy(testingSchedulingTopology);
    regionPartitionGroupReleaseStrategy.vertexFinished(onlyIntermediateVertexId);
    final List<IntermediateResultPartitionID> partitionsToRelease = getReleasablePartitions(regionPartitionGroupReleaseStrategy, onlySinkVertexId);
    assertThat(partitionsToRelease, contains(onlySourceResultPartitionId));
}
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 3 with TestingSchedulingResultPartition

use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition 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 4 with TestingSchedulingResultPartition

use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition 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 5 with TestingSchedulingResultPartition

use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition 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)

Aggregations

TestingSchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex)5 TestingSchedulingResultPartition (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition)5 Test (org.junit.Test)5 TestingSchedulingTopology (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology)3 RegionPartitionGroupReleaseStrategy (org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy)2 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)2 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)2