Search in sources :

Example 1 with RegionPartitionGroupReleaseStrategy

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()));
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) 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 2 with RegionPartitionGroupReleaseStrategy

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()));
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) RegionPartitionGroupReleaseStrategy(org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) Test(org.junit.Test)

Example 3 with RegionPartitionGroupReleaseStrategy

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

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()));
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) 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 5 with RegionPartitionGroupReleaseStrategy

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

Aggregations

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