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));
}
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);
}
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);
}
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);
}
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);
}
Aggregations