Search in sources :

Example 1 with TestingSchedulingExecutionVertex

use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex 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 TestingSchedulingExecutionVertex

use of org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex 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 TestingSchedulingExecutionVertex

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

the class RestartAllFailoverStrategyTest method testGetTasksNeedingRestart.

@Test
public void testGetTasksNeedingRestart() {
    final TestingSchedulingTopology topology = new TestingSchedulingTopology();
    final TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex();
    final TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex();
    final TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex();
    topology.connect(v1, v2, ResultPartitionType.PIPELINED);
    topology.connect(v2, v3, ResultPartitionType.BLOCKING);
    final RestartAllFailoverStrategy strategy = new RestartAllFailoverStrategy(topology);
    assertEquals(new HashSet<>(Arrays.asList(v1.getId(), v2.getId(), v3.getId())), strategy.getTasksNeedingRestart(v1.getId(), new Exception("Test failure")));
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) Test(org.junit.Test)

Example 4 with TestingSchedulingExecutionVertex

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

the class RestartPipelinedRegionFailoverStrategyTest method testRegionFailoverForVariousResultPartitionAvailabilityCombinations.

/**
 * Tests to verify region failover results regarding different input result partition
 * availability combinations.
 *
 * <pre>
 *     (v1) --rp1--\
 *                 (v3)
 *     (v2) --rp2--/
 *
 *             ^
 *             |
 *         (blocking)
 * </pre>
 *
 * Each vertex is in an individual region. rp1, rp2 are result partitions.
 */
@Test
public void testRegionFailoverForVariousResultPartitionAvailabilityCombinations() throws Exception {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex(ExecutionState.FINISHED);
    TestingSchedulingExecutionVertex v3 = topology.newExecutionVertex(ExecutionState.RUNNING);
    topology.connect(v1, v3, ResultPartitionType.BLOCKING);
    topology.connect(v2, v3, ResultPartitionType.BLOCKING);
    TestResultPartitionAvailabilityChecker availabilityChecker = new TestResultPartitionAvailabilityChecker();
    RestartPipelinedRegionFailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology, availabilityChecker);
    IntermediateResultPartitionID rp1ID = v1.getProducedResults().iterator().next().getId();
    IntermediateResultPartitionID rp2ID = v2.getProducedResults().iterator().next().getId();
    // -------------------------------------------------
    // Combination1: (rp1 == available, rp2 == available)
    // -------------------------------------------------
    availabilityChecker.failedPartitions.clear();
    verifyThatFailedExecution(strategy, v1).restarts(v1, v3);
    verifyThatFailedExecution(strategy, v2).restarts(v2, v3);
    verifyThatFailedExecution(strategy, v3).restarts(v3);
    // -------------------------------------------------
    // Combination2: (rp1 == unavailable, rp2 == available)
    // -------------------------------------------------
    availabilityChecker.failedPartitions.clear();
    availabilityChecker.markResultPartitionFailed(rp1ID);
    verifyThatFailedExecution(strategy, v1).restarts(v1, v3);
    verifyThatFailedExecution(strategy, v2).restarts(v1, v2, v3);
    verifyThatFailedExecution(strategy, v3).restarts(v1, v3);
    // -------------------------------------------------
    // Combination3: (rp1 == available, rp2 == unavailable)
    // -------------------------------------------------
    availabilityChecker.failedPartitions.clear();
    availabilityChecker.markResultPartitionFailed(rp2ID);
    verifyThatFailedExecution(strategy, v1).restarts(v1, v2, v3);
    verifyThatFailedExecution(strategy, v2).restarts(v2, v3);
    verifyThatFailedExecution(strategy, v3).restarts(v2, v3);
    // -------------------------------------------------
    // Combination4: (rp1 == unavailable, rp == unavailable)
    // -------------------------------------------------
    availabilityChecker.failedPartitions.clear();
    availabilityChecker.markResultPartitionFailed(rp1ID);
    availabilityChecker.markResultPartitionFailed(rp2ID);
    verifyThatFailedExecution(strategy, v1).restarts(v1, v2, v3);
    verifyThatFailedExecution(strategy, v2).restarts(v1, v2, v3);
    verifyThatFailedExecution(strategy, v3).restarts(v1, v2, v3);
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingTopology(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) Test(org.junit.Test)

Example 5 with TestingSchedulingExecutionVertex

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

the class RestartPipelinedRegionFailoverStrategyTest method testRegionFailoverDoesNotRestartCreatedExecutions.

/**
 * Tests region failover does not restart vertexes which are already in initial CREATED state.
 *
 * <pre>
 *     (v1) --|--> (v2)
 *
 *            ^
 *            |
 *       (blocking)
 * </pre>
 *
 * Component 1: 1; component 2: 2
 */
@Test
public void testRegionFailoverDoesNotRestartCreatedExecutions() {
    TestingSchedulingTopology topology = new TestingSchedulingTopology();
    TestingSchedulingExecutionVertex v1 = topology.newExecutionVertex(ExecutionState.CREATED);
    TestingSchedulingExecutionVertex v2 = topology.newExecutionVertex(ExecutionState.CREATED);
    topology.connect(v1, v2, ResultPartitionType.BLOCKING);
    FailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology);
    verifyThatFailedExecution(strategy, v2).restarts();
    TestingSchedulingResultPartition v1out = v2.getConsumedResults().iterator().next();
    verifyThatFailedExecution(strategy, v2).partitionConnectionCause(v1out).restarts();
}
Also used : TestingSchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex) TestingSchedulingResultPartition(org.apache.flink.runtime.scheduler.strategy.TestingSchedulingResultPartition) 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