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));
}
Aggregations