Search in sources :

Example 6 with DefaultExecutionGraph

use of org.apache.flink.runtime.executiongraph.DefaultExecutionGraph in project flink by apache.

the class AdaptiveBatchSchedulerTest method testDecideParallelismForForwardTarget.

@Test
public void testDecideParallelismForForwardTarget() throws Exception {
    JobGraph jobGraph = createJobGraph(true);
    Iterator<JobVertex> jobVertexIterator = jobGraph.getVertices().iterator();
    JobVertex source1 = jobVertexIterator.next();
    JobVertex source2 = jobVertexIterator.next();
    JobVertex sink = jobVertexIterator.next();
    SchedulerBase scheduler = createScheduler(jobGraph);
    final DefaultExecutionGraph graph = (DefaultExecutionGraph) scheduler.getExecutionGraph();
    final ExecutionJobVertex sinkExecutionJobVertex = graph.getJobVertex(sink.getID());
    scheduler.startScheduling();
    assertThat(sinkExecutionJobVertex.getParallelism(), is(-1));
    // trigger source1 finished.
    transitionExecutionsState(scheduler, ExecutionState.FINISHED, source1);
    assertThat(sinkExecutionJobVertex.getParallelism(), is(-1));
    // trigger source2 finished.
    transitionExecutionsState(scheduler, ExecutionState.FINISHED, source2);
    assertThat(sinkExecutionJobVertex.getParallelism(), is(SOURCE_PARALLELISM_1));
    // check that the jobGraph is updated
    assertThat(sink.getParallelism(), is(SOURCE_PARALLELISM_1));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) JobVertex(org.apache.flink.runtime.jobgraph.JobVertex) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) SchedulerBase(org.apache.flink.runtime.scheduler.SchedulerBase) DefaultExecutionGraph(org.apache.flink.runtime.executiongraph.DefaultExecutionGraph) Test(org.junit.Test)

Aggregations

DefaultExecutionGraph (org.apache.flink.runtime.executiongraph.DefaultExecutionGraph)6 ExecutionJobVertex (org.apache.flink.runtime.executiongraph.ExecutionJobVertex)5 Test (org.junit.Test)5 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)4 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)2 SlotSharingGroup (org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup)2 SchedulerBase (org.apache.flink.runtime.scheduler.SchedulerBase)2 HashSet (java.util.HashSet)1 MemorySize (org.apache.flink.configuration.MemorySize)1 IntermediateResult (org.apache.flink.runtime.executiongraph.IntermediateResult)1 IntermediateResultPartitionTest (org.apache.flink.runtime.executiongraph.IntermediateResultPartitionTest)1 IntermediateDataSetID (org.apache.flink.runtime.jobgraph.IntermediateDataSetID)1 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)1 ConsumedPartitionGroup (org.apache.flink.runtime.scheduler.strategy.ConsumedPartitionGroup)1 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)1