use of org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy in project flink by apache.
the class RegionPartitionGroupReleaseStrategyTest method toggleVertexFinishedUnfinished.
@Test
public void toggleVertexFinishedUnfinished() {
final List<TestingSchedulingExecutionVertex> producers = testingSchedulingTopology.addExecutionVertices().finish();
final List<TestingSchedulingExecutionVertex> consumers = testingSchedulingTopology.addExecutionVertices().withParallelism(2).finish();
testingSchedulingTopology.connectAllToAll(producers, consumers).finish();
final ExecutionVertexID consumerVertex1 = consumers.get(0).getId();
final ExecutionVertexID consumerVertex2 = consumers.get(1).getId();
final RegionPartitionGroupReleaseStrategy regionPartitionGroupReleaseStrategy = new RegionPartitionGroupReleaseStrategy(testingSchedulingTopology);
regionPartitionGroupReleaseStrategy.vertexFinished(consumerVertex1);
regionPartitionGroupReleaseStrategy.vertexFinished(consumerVertex2);
regionPartitionGroupReleaseStrategy.vertexUnfinished(consumerVertex2);
final List<IntermediateResultPartitionID> partitionsToRelease = getReleasablePartitions(regionPartitionGroupReleaseStrategy, consumerVertex1);
assertThat(partitionsToRelease, is(empty()));
}
use of org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy in project flink by apache.
the class RegionPartitionGroupReleaseStrategyTest method updateStrategyOnTopologyUpdate.
@Test
public void updateStrategyOnTopologyUpdate() {
final TestingSchedulingExecutionVertex ev1 = testingSchedulingTopology.newExecutionVertex();
final RegionPartitionGroupReleaseStrategy regionPartitionReleaseStrategy = new RegionPartitionGroupReleaseStrategy(testingSchedulingTopology);
regionPartitionReleaseStrategy.vertexFinished(ev1.getId());
final TestingSchedulingExecutionVertex ev2 = testingSchedulingTopology.newExecutionVertex();
testingSchedulingTopology.connect(ev1, ev2, ResultPartitionType.BLOCKING);
regionPartitionReleaseStrategy.notifySchedulingTopologyUpdated(testingSchedulingTopology, Collections.singletonList(ev2.getId()));
// this check ensures that existing region views are not affected
assertThat(regionPartitionReleaseStrategy.isRegionOfVertexFinished(ev1.getId()), is(true));
assertThat(regionPartitionReleaseStrategy.isRegionOfVertexFinished(ev2.getId()), is(false));
List<IntermediateResultPartitionID> releasablePartitions = getReleasablePartitions(regionPartitionReleaseStrategy, ev2.getId());
assertThat(regionPartitionReleaseStrategy.isRegionOfVertexFinished(ev2.getId()), is(true));
assertThat(releasablePartitions, contains(ev1.getProducedResults().iterator().next().getId()));
}
use of org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy 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));
}
use of org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy in project flink by apache.
the class RegionPartitionGroupReleaseStrategyTest method notReleasePartitionsIfDownstreamRegionIsNotFinished.
@Test
public void notReleasePartitionsIfDownstreamRegionIsNotFinished() {
final List<TestingSchedulingExecutionVertex> producers = testingSchedulingTopology.addExecutionVertices().finish();
final List<TestingSchedulingExecutionVertex> consumers = testingSchedulingTopology.addExecutionVertices().withParallelism(2).finish();
testingSchedulingTopology.connectAllToAll(producers, consumers).finish();
final ExecutionVertexID consumerVertex1 = consumers.get(0).getId();
final RegionPartitionGroupReleaseStrategy regionPartitionGroupReleaseStrategy = new RegionPartitionGroupReleaseStrategy(testingSchedulingTopology);
final List<IntermediateResultPartitionID> partitionsToRelease = getReleasablePartitions(regionPartitionGroupReleaseStrategy, consumerVertex1);
assertThat(partitionsToRelease, is(empty()));
}
use of org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy 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));
}
Aggregations