use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology 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);
}
use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology 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()));
}
use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology 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()));
}
use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology in project flink by apache.
the class LocalInputPreferredSlotSharingStrategyTest method setUp.
@Before
public void setUp() throws Exception {
topology = new TestingSchedulingTopology();
ev11 = topology.newExecutionVertex(JOB_VERTEX_ID_1, 0);
ev12 = topology.newExecutionVertex(JOB_VERTEX_ID_1, 1);
ev21 = topology.newExecutionVertex(JOB_VERTEX_ID_2, 0);
ev22 = topology.newExecutionVertex(JOB_VERTEX_ID_2, 1);
final SlotSharingGroup slotSharingGroup = new SlotSharingGroup();
slotSharingGroup.addVertexToGroup(JOB_VERTEX_ID_1);
slotSharingGroup.addVertexToGroup(JOB_VERTEX_ID_2);
slotSharingGroups = Collections.singleton(slotSharingGroup);
}
use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology 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);
}
Aggregations