Search in sources :

Example 21 with TestingSchedulingExecutionVertex

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

the class LocalInputPreferredSlotSharingStrategyTest method testInputLocalityIsRespectedWithRescaleEdge.

@Test
public void testInputLocalityIsRespectedWithRescaleEdge() {
    final TestingSchedulingTopology topology = new TestingSchedulingTopology();
    final TestingSchedulingExecutionVertex ev11 = topology.newExecutionVertex(JOB_VERTEX_ID_1, 0);
    final TestingSchedulingExecutionVertex ev12 = topology.newExecutionVertex(JOB_VERTEX_ID_1, 1);
    final TestingSchedulingExecutionVertex ev21 = topology.newExecutionVertex(JOB_VERTEX_ID_2, 0);
    final TestingSchedulingExecutionVertex ev22 = topology.newExecutionVertex(JOB_VERTEX_ID_2, 1);
    final TestingSchedulingExecutionVertex ev23 = topology.newExecutionVertex(JOB_VERTEX_ID_2, 2);
    topology.connect(ev11, ev21);
    topology.connect(ev11, ev22);
    topology.connect(ev12, ev23);
    final SlotSharingStrategy strategy = new LocalInputPreferredSlotSharingStrategy(topology, slotSharingGroups, Collections.emptySet());
    assertThat(strategy.getExecutionSlotSharingGroups(), hasSize(3));
    assertThat(strategy.getExecutionSlotSharingGroup(ev21.getId()).getExecutionVertexIds(), containsInAnyOrder(ev11.getId(), ev21.getId()));
    assertThat(strategy.getExecutionSlotSharingGroup(ev22.getId()).getExecutionVertexIds(), containsInAnyOrder(ev22.getId()));
    assertThat(strategy.getExecutionSlotSharingGroup(ev23.getId()).getExecutionVertexIds(), containsInAnyOrder(ev12.getId(), ev23.getId()));
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 22 with TestingSchedulingExecutionVertex

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

the class LocalInputPreferredSlotSharingStrategyTest method testInputLocalityIsRespectedWithAllToAllEdge.

@Test
public void testInputLocalityIsRespectedWithAllToAllEdge() {
    final TestingSchedulingTopology topology = new TestingSchedulingTopology();
    final List<TestingSchedulingExecutionVertex> producer = topology.addExecutionVertices().withParallelism(2).withJobVertexID(JOB_VERTEX_ID_1).finish();
    final List<TestingSchedulingExecutionVertex> consumer = topology.addExecutionVertices().withParallelism(2).withJobVertexID(JOB_VERTEX_ID_2).finish();
    topology.connectAllToAll(producer, consumer).withResultPartitionType(ResultPartitionType.BLOCKING).finish();
    ev11 = producer.get(0);
    ev12 = producer.get(1);
    ev21 = consumer.get(0);
    ev22 = consumer.get(1);
    final SlotSharingStrategy strategy = new LocalInputPreferredSlotSharingStrategy(topology, slotSharingGroups, Collections.emptySet());
    assertThat(strategy.getExecutionSlotSharingGroups(), hasSize(2));
    assertThat(strategy.getExecutionSlotSharingGroup(ev21.getId()).getExecutionVertexIds(), containsInAnyOrder(ev11.getId(), ev21.getId()));
    assertThat(strategy.getExecutionSlotSharingGroup(ev22.getId()).getExecutionVertexIds(), containsInAnyOrder(ev12.getId(), ev22.getId()));
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 23 with TestingSchedulingExecutionVertex

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

the class ConsumerRegionGroupExecutionViewMaintainerTest method createProducerAndConsumer.

private void createProducerAndConsumer() {
    TestingSchedulingExecutionVertex producer = TestingSchedulingExecutionVertex.newBuilder().build();
    TestingSchedulingExecutionVertex consumer = TestingSchedulingExecutionVertex.newBuilder().build();
    producerRegion = new TestingSchedulingPipelinedRegion(Collections.singleton(producer));
    consumerRegion = new TestingSchedulingPipelinedRegion(Collections.singleton(consumer));
}
Also used : TestingSchedulingPipelinedRegion(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingPipelinedRegion) TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex)

Example 24 with TestingSchedulingExecutionVertex

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

the class SchedulingPipelinedRegionComputeUtilTest method testTwoComponentsViaBlockingExchange.

/**
 * Tests the below topology.
 *
 * <pre>
 *     (a1) -+-> (b1) -+-> (c1)
 *           X
 *     (a2) -+-> (b2) -+-> (c2)
 *
 *           ^         ^
 *           |         |
 *     (pipelined) (blocking)
 * </pre>
 */
@Test
public void testTwoComponentsViaBlockingExchange() {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex va1 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex va2 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex vb1 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex vb2 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex vc1 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex vc2 = topology.newExecutionVertex();
    topology.connect(va1, vb1, ResultPartitionType.PIPELINED).connect(va1, vb2, ResultPartitionType.PIPELINED).connect(va2, vb1, ResultPartitionType.PIPELINED).connect(va2, vb2, ResultPartitionType.PIPELINED).connect(vb1, vc1, ResultPartitionType.BLOCKING).connect(vb2, vc2, ResultPartitionType.BLOCKING);
    Map<ExecutionVertexID, Set<SchedulingExecutionVertex>> pipelinedRegionByVertex = computePipelinedRegionByVertex(topology);
    Set<SchedulingExecutionVertex> ra1 = pipelinedRegionByVertex.get(va1.getId());
    Set<SchedulingExecutionVertex> ra2 = pipelinedRegionByVertex.get(va2.getId());
    Set<SchedulingExecutionVertex> rb1 = pipelinedRegionByVertex.get(vb1.getId());
    Set<SchedulingExecutionVertex> rb2 = pipelinedRegionByVertex.get(vb2.getId());
    Set<SchedulingExecutionVertex> rc1 = pipelinedRegionByVertex.get(vc1.getId());
    Set<SchedulingExecutionVertex> rc2 = pipelinedRegionByVertex.get(vc2.getId());
    assertSameRegion(ra1, ra2, rb1, rb2);
    assertDistinctRegions(ra1, rc1, rc2);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) SchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex) Set(java.util.Set) TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 25 with TestingSchedulingExecutionVertex

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

the class SchedulingPipelinedRegionComputeUtilTest method testIndividualVertices.

/**
 * Tests that validates that a graph with single unconnected vertices works correctly.
 *
 * <pre>
 *     (v1)
 *
 *     (v2)
 *
 *     (v3)
 * </pre>
 */
@Test
public void testIndividualVertices() {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex();
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex();
    Map<ExecutionVertexID, Set<SchedulingExecutionVertex>> pipelinedRegionByVertex = computePipelinedRegionByVertex(topology);
    Set<SchedulingExecutionVertex> r1 = pipelinedRegionByVertex.get(v1.getId());
    Set<SchedulingExecutionVertex> r2 = pipelinedRegionByVertex.get(v2.getId());
    Set<SchedulingExecutionVertex> r3 = pipelinedRegionByVertex.get(v3.getId());
    assertDistinctRegions(r1, r2, r3);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) SchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex) Set(java.util.Set) TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Aggregations

TestingSchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex)27 Test (org.junit.Test)26 TestingSchedulingTopology (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology)21 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)15 Set (java.util.Set)11 SchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex)11 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)6 RegionPartitionGroupReleaseStrategy (org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionGroupReleaseStrategy)5 TestingSchedulingResultPartition (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition)5 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)1 SlotSharingGroup (org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup)1 TestingSchedulingPipelinedRegion (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingPipelinedRegion)1