Java Code Examples for org.apache.flink.runtime.executiongraph.ExecutionVertex#getInputEdges()

The following examples show how to use org.apache.flink.runtime.executiongraph.ExecutionVertex#getInputEdges() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExecutionGraphToSchedulingTopologyAdapter.java    From flink with Apache License 2.0 6 votes vote down vote up
private static void connectVerticesToConsumedPartitions(
	Map<ExecutionVertex, DefaultSchedulingExecutionVertex> executionVertexMap,
	Map<IntermediateResultPartitionID, DefaultSchedulingResultPartition> resultPartitions) {

	for (Map.Entry<ExecutionVertex, DefaultSchedulingExecutionVertex> mapEntry : executionVertexMap.entrySet()) {
		final DefaultSchedulingExecutionVertex schedulingVertex = mapEntry.getValue();
		final ExecutionVertex executionVertex = mapEntry.getKey();

		for (int index = 0; index < executionVertex.getNumberOfInputs(); index++) {
			for (ExecutionEdge edge : executionVertex.getInputEdges(index)) {
				DefaultSchedulingResultPartition partition = resultPartitions.get(edge.getSource().getPartitionId());
				schedulingVertex.addConsumedPartition(partition);
				partition.addConsumer(schedulingVertex);
			}
		}
	}
}
 
Example 2
Source File: ExecutionGraphToInputsLocationsRetrieverAdapter.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public Collection<Collection<ExecutionVertexID>> getConsumedResultPartitionsProducers(
		ExecutionVertexID executionVertexId) {
	ExecutionVertex ev = getExecutionVertex(executionVertexId);

	List<Collection<ExecutionVertexID>> resultPartitionProducers = new ArrayList<>(ev.getNumberOfInputs());
	for (int i = 0; i < ev.getNumberOfInputs(); i++) {
		ExecutionEdge[] inputEdges = ev.getInputEdges(i);
		List<ExecutionVertexID> producers = new ArrayList<>(inputEdges.length);
		for (ExecutionEdge inputEdge : inputEdges) {
			ExecutionVertex producer = inputEdge.getSource().getProducer();
			producers.add(new ExecutionVertexID(producer.getJobvertexId(), producer.getParallelSubtaskIndex()));
		}
		resultPartitionProducers.add(producers);

	}
	return resultPartitionProducers;
}
 
Example 3
Source File: DefaultExecutionTopology.java    From flink with Apache License 2.0 6 votes vote down vote up
private static void connectVerticesToConsumedPartitions(
	Map<ExecutionVertex, DefaultExecutionVertex> executionVertexMap,
	Map<IntermediateResultPartitionID, DefaultResultPartition> resultPartitions) {

	for (Map.Entry<ExecutionVertex, DefaultExecutionVertex> mapEntry : executionVertexMap.entrySet()) {
		final DefaultExecutionVertex schedulingVertex = mapEntry.getValue();
		final ExecutionVertex executionVertex = mapEntry.getKey();

		for (int index = 0; index < executionVertex.getNumberOfInputs(); index++) {
			for (ExecutionEdge edge : executionVertex.getInputEdges(index)) {
				DefaultResultPartition partition = resultPartitions.get(edge.getSource().getPartitionId());
				schedulingVertex.addConsumedResult(partition);
				partition.addConsumer(schedulingVertex);
			}
		}
	}
}
 
Example 4
Source File: ExecutionGraphToInputsLocationsRetrieverAdapter.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public Collection<Collection<ExecutionVertexID>> getConsumedResultPartitionsProducers(
		ExecutionVertexID executionVertexId) {
	ExecutionVertex ev = getExecutionVertex(executionVertexId);

	List<Collection<ExecutionVertexID>> resultPartitionProducers = new ArrayList<>(ev.getNumberOfInputs());
	for (int i = 0; i < ev.getNumberOfInputs(); i++) {
		ExecutionEdge[] inputEdges = ev.getInputEdges(i);
		List<ExecutionVertexID> producers = new ArrayList<>(inputEdges.length);
		for (ExecutionEdge inputEdge : inputEdges) {
			ExecutionVertex producer = inputEdge.getSource().getProducer();
			producers.add(producer.getID());
		}
		resultPartitionProducers.add(producers);

	}
	return resultPartitionProducers;
}