Search in sources :

Example 46 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID 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 47 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID 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 48 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID 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 49 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID in project flink by apache.

the class DefaultExecutionTopologyTest method assertGraphEquals.

private static void assertGraphEquals(ExecutionGraph originalGraph, DefaultExecutionTopology adaptedTopology) {
    Iterator<ExecutionVertex> originalVertices = originalGraph.getAllExecutionVertices().iterator();
    Iterator<DefaultExecutionVertex> adaptedVertices = adaptedTopology.getVertices().iterator();
    while (originalVertices.hasNext()) {
        ExecutionVertex originalVertex = originalVertices.next();
        DefaultExecutionVertex adaptedVertex = adaptedVertices.next();
        assertEquals(originalVertex.getID(), adaptedVertex.getId());
        List<IntermediateResultPartition> originalConsumedPartitions = new ArrayList<>();
        for (ConsumedPartitionGroup consumedPartitionGroup : originalVertex.getAllConsumedPartitionGroups()) {
            for (IntermediateResultPartitionID partitionId : consumedPartitionGroup) {
                IntermediateResultPartition partition = originalVertex.getExecutionGraphAccessor().getResultPartitionOrThrow(partitionId);
                originalConsumedPartitions.add(partition);
            }
        }
        Iterable<DefaultResultPartition> adaptedConsumedPartitions = adaptedVertex.getConsumedResults();
        assertPartitionsEquals(originalConsumedPartitions, adaptedConsumedPartitions);
        Collection<IntermediateResultPartition> originalProducedPartitions = originalVertex.getProducedPartitions().values();
        Iterable<DefaultResultPartition> adaptedProducedPartitions = adaptedVertex.getProducedResults();
        assertPartitionsEquals(originalProducedPartitions, adaptedProducedPartitions);
    }
    assertFalse("Number of adapted vertices exceeds number of original vertices.", adaptedVertices.hasNext());
}
Also used : ConsumedPartitionGroup(org.apache.flink.runtime.scheduler.strategy.ConsumedPartitionGroup) IntermediateResultPartition(org.apache.flink.runtime.executiongraph.IntermediateResultPartition) ArrayList(java.util.ArrayList) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)

Example 50 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID in project flink by apache.

the class DefaultExecutionTopologyTest method testGetResultPartition.

@Test
public void testGetResultPartition() {
    for (ExecutionVertex vertex : executionGraph.getAllExecutionVertices()) {
        for (Map.Entry<IntermediateResultPartitionID, IntermediateResultPartition> entry : vertex.getProducedPartitions().entrySet()) {
            IntermediateResultPartition partition = entry.getValue();
            DefaultResultPartition schedulingResultPartition = adapter.getResultPartition(entry.getKey());
            assertPartitionEquals(partition, schedulingResultPartition);
        }
    }
}
Also used : IntermediateResultPartition(org.apache.flink.runtime.executiongraph.IntermediateResultPartition) Map(java.util.Map) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) Test(org.junit.Test)

Aggregations

IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)66 Test (org.junit.Test)41 IntermediateDataSetID (org.apache.flink.runtime.jobgraph.IntermediateDataSetID)18 ConsumedPartitionGroup (org.apache.flink.runtime.scheduler.strategy.ConsumedPartitionGroup)14 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)13 JobID (org.apache.flink.api.common.JobID)12 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)12 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)11 ArrayList (java.util.ArrayList)10 TaskDeploymentDescriptor (org.apache.flink.runtime.deployment.TaskDeploymentDescriptor)10 ResultPartitionID (org.apache.flink.runtime.io.network.partition.ResultPartitionID)10 InputGateDeploymentDescriptor (org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor)9 ResultPartitionDeploymentDescriptor (org.apache.flink.runtime.deployment.ResultPartitionDeploymentDescriptor)9 CompletableFuture (java.util.concurrent.CompletableFuture)8 Configuration (org.apache.flink.configuration.Configuration)8 ShuffleDescriptor (org.apache.flink.runtime.shuffle.ShuffleDescriptor)8 IOException (java.io.IOException)7 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)7 Collection (java.util.Collection)6 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)6