Java Code Examples for org.apache.flink.runtime.operators.util.LocalStrategy#NONE

The following examples show how to use org.apache.flink.runtime.operators.util.LocalStrategy#NONE . 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: BinaryUnionReplacer.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public void collect(Channel in, List<Channel> inputs) {
	if (in.getSource() instanceof NAryUnionPlanNode) {
		// sanity check
		if (in.getShipStrategy() != ShipStrategyType.FORWARD) {
			throw new CompilerException("Bug: Plan generation for Unions picked a ship strategy between binary plan operators.");
		}
		if (!(in.getLocalStrategy() == null || in.getLocalStrategy() == LocalStrategy.NONE)) {
			throw new CompilerException("Bug: Plan generation for Unions picked a local strategy between binary plan operators.");
		}

		inputs.addAll(((NAryUnionPlanNode) in.getSource()).getListOfInputs());
	} else {
		// is not a collapsed union node, so we take the channel directly
		inputs.add(in);
	}
}
 
Example 2
Source File: BinaryUnionReplacer.java    From flink with Apache License 2.0 6 votes vote down vote up
public void collect(Channel in, List<Channel> inputs) {
	if (in.getSource() instanceof NAryUnionPlanNode) {
		// sanity check
		if (in.getShipStrategy() != ShipStrategyType.FORWARD) {
			throw new CompilerException("Bug: Plan generation for Unions picked a ship strategy between binary plan operators.");
		}
		if (!(in.getLocalStrategy() == null || in.getLocalStrategy() == LocalStrategy.NONE)) {
			throw new CompilerException("Bug: Plan generation for Unions picked a local strategy between binary plan operators.");
		}

		inputs.addAll(((NAryUnionPlanNode) in.getSource()).getListOfInputs());
	} else {
		// is not a collapsed union node, so we take the channel directly
		inputs.add(in);
	}
}
 
Example 3
Source File: BinaryUnionReplacer.java    From flink with Apache License 2.0 6 votes vote down vote up
public void collect(Channel in, List<Channel> inputs) {
	if (in.getSource() instanceof NAryUnionPlanNode) {
		// sanity check
		if (in.getShipStrategy() != ShipStrategyType.FORWARD) {
			throw new CompilerException("Bug: Plan generation for Unions picked a ship strategy between binary plan operators.");
		}
		if (!(in.getLocalStrategy() == null || in.getLocalStrategy() == LocalStrategy.NONE)) {
			throw new CompilerException("Bug: Plan generation for Unions picked a local strategy between binary plan operators.");
		}

		inputs.addAll(((NAryUnionPlanNode) in.getSource()).getListOfInputs());
	} else {
		// is not a collapsed union node, so we take the channel directly
		inputs.add(in);
	}
}
 
Example 4
Source File: JobGraphGenerator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private void addLocalInfoFromChannelToConfig(Channel channel, TaskConfig config, int inputNum, boolean isBroadcastChannel) {
	// serializer
	if (isBroadcastChannel) {
		config.setBroadcastInputSerializer(channel.getSerializer(), inputNum);
		
		if (channel.getLocalStrategy() != LocalStrategy.NONE || (channel.getTempMode() != null && channel.getTempMode() != TempMode.NONE)) {
			throw new CompilerException("Found local strategy or temp mode on a broadcast variable channel.");
		} else {
			return;
		}
	} else {
		config.setInputSerializer(channel.getSerializer(), inputNum);
	}
	
	// local strategy
	if (channel.getLocalStrategy() != LocalStrategy.NONE) {
		config.setInputLocalStrategy(inputNum, channel.getLocalStrategy());
		if (channel.getLocalStrategyComparator() != null) {
			config.setInputComparator(channel.getLocalStrategyComparator(), inputNum);
		}
	}
	
	assignLocalStrategyResources(channel, config, inputNum);
	
	// materialization / caching
	if (channel.getTempMode() != null) {
		final TempMode tm = channel.getTempMode();

		boolean needsMemory = false;
		// Don't add a pipeline breaker if the data exchange is already blocking, EXCEPT the channel is within an iteration.
		if (tm.breaksPipeline() &&
				(channel.isOnDynamicPath() || channel.getDataExchangeMode() != DataExchangeMode.BATCH) ) {
			config.setInputAsynchronouslyMaterialized(inputNum, true);
			needsMemory = true;
		}
		if (tm.isCached()) {
			config.setInputCached(inputNum, true);
			needsMemory = true;
		}
		
		if (needsMemory) {
			// sanity check
			if (tm == TempMode.NONE || channel.getRelativeTempMemory() <= 0) {
				throw new CompilerException("Bug in compiler: Inconsistent description of input materialization.");
			}
			config.setRelativeInputMaterializationMemory(inputNum, channel.getRelativeTempMemory());
		}
	}
}
 
Example 5
Source File: PlanNode.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public FeedbackPropertiesMeetRequirementsReport checkPartialSolutionPropertiesMet(PlanNode partialSolution, GlobalProperties feedbackGlobal, LocalProperties feedbackLocal) {
	if (this == partialSolution) {
		return FeedbackPropertiesMeetRequirementsReport.PENDING;
	}
	
	boolean found = false;
	boolean allMet = true;
	boolean allLocallyMet = true;
	
	for (Channel input : getInputs()) {
		FeedbackPropertiesMeetRequirementsReport inputState = input.getSource().checkPartialSolutionPropertiesMet(partialSolution, feedbackGlobal, feedbackLocal);
		
		if (inputState == FeedbackPropertiesMeetRequirementsReport.NO_PARTIAL_SOLUTION) {
			continue;
		}
		else if (inputState == FeedbackPropertiesMeetRequirementsReport.MET) {
			found = true;
			continue;
		}
		else if (inputState == FeedbackPropertiesMeetRequirementsReport.NOT_MET) {
			return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
		}
		else {
			found = true;
			
			// the partial solution was on the path here. check whether the channel requires
			// certain properties that are met, or whether the channel introduces new properties
			
			// if the plan introduces new global properties, then we can stop looking whether
			// the feedback properties are sufficient to meet the requirements
			if (input.getShipStrategy() != ShipStrategyType.FORWARD && input.getShipStrategy() != ShipStrategyType.NONE) {
				continue;
			}
			
			// first check whether this channel requires something that is not met
			if (input.getRequiredGlobalProps() != null && !input.getRequiredGlobalProps().isMetBy(feedbackGlobal)) {
				return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
			}
			
			// in general, not everything is met here already
			allMet = false;
			
			// if the plan introduces new local properties, we can stop checking for matching local properties
			if (inputState != FeedbackPropertiesMeetRequirementsReport.PENDING_LOCAL_MET) {
				
				if (input.getLocalStrategy() == LocalStrategy.NONE) {
					
					if (input.getRequiredLocalProps() != null && !input.getRequiredLocalProps().isMetBy(feedbackLocal)) {
						return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
					}
					
					allLocallyMet = false;
				}
			}
		}
	}
	
	if (!found) {
		return FeedbackPropertiesMeetRequirementsReport.NO_PARTIAL_SOLUTION;
	} else if (allMet) {
		return FeedbackPropertiesMeetRequirementsReport.MET;
	} else if (allLocallyMet) {
		return FeedbackPropertiesMeetRequirementsReport.PENDING_LOCAL_MET;
	} else {
		return FeedbackPropertiesMeetRequirementsReport.PENDING;
	}
}
 
Example 6
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 4 votes vote down vote up
private void addLocalInfoFromChannelToConfig(Channel channel, TaskConfig config, int inputNum, boolean isBroadcastChannel) {
	// serializer
	if (isBroadcastChannel) {
		config.setBroadcastInputSerializer(channel.getSerializer(), inputNum);
		
		if (channel.getLocalStrategy() != LocalStrategy.NONE || (channel.getTempMode() != null && channel.getTempMode() != TempMode.NONE)) {
			throw new CompilerException("Found local strategy or temp mode on a broadcast variable channel.");
		} else {
			return;
		}
	} else {
		config.setInputSerializer(channel.getSerializer(), inputNum);
	}
	
	// local strategy
	if (channel.getLocalStrategy() != LocalStrategy.NONE) {
		config.setInputLocalStrategy(inputNum, channel.getLocalStrategy());
		if (channel.getLocalStrategyComparator() != null) {
			config.setInputComparator(channel.getLocalStrategyComparator(), inputNum);
		}
	}
	
	assignLocalStrategyResources(channel, config, inputNum);
	
	// materialization / caching
	if (channel.getTempMode() != null) {
		final TempMode tm = channel.getTempMode();

		boolean needsMemory = false;
		// Don't add a pipeline breaker if the data exchange is already blocking, EXCEPT the channel is within an iteration.
		if (tm.breaksPipeline() &&
				(channel.isOnDynamicPath() || channel.getDataExchangeMode() != DataExchangeMode.BATCH) ) {
			config.setInputAsynchronouslyMaterialized(inputNum, true);
			needsMemory = true;
		}
		if (tm.isCached()) {
			config.setInputCached(inputNum, true);
			needsMemory = true;
		}
		
		if (needsMemory) {
			// sanity check
			if (tm == TempMode.NONE || channel.getRelativeTempMemory() <= 0) {
				throw new CompilerException("Bug in compiler: Inconsistent description of input materialization.");
			}
			config.setRelativeInputMaterializationMemory(inputNum, channel.getRelativeTempMemory());
		}
	}
}
 
Example 7
Source File: PlanNode.java    From flink with Apache License 2.0 4 votes vote down vote up
public FeedbackPropertiesMeetRequirementsReport checkPartialSolutionPropertiesMet(PlanNode partialSolution, GlobalProperties feedbackGlobal, LocalProperties feedbackLocal) {
	if (this == partialSolution) {
		return FeedbackPropertiesMeetRequirementsReport.PENDING;
	}
	
	boolean found = false;
	boolean allMet = true;
	boolean allLocallyMet = true;
	
	for (Channel input : getInputs()) {
		FeedbackPropertiesMeetRequirementsReport inputState = input.getSource().checkPartialSolutionPropertiesMet(partialSolution, feedbackGlobal, feedbackLocal);
		
		if (inputState == FeedbackPropertiesMeetRequirementsReport.NO_PARTIAL_SOLUTION) {
			continue;
		}
		else if (inputState == FeedbackPropertiesMeetRequirementsReport.MET) {
			found = true;
			continue;
		}
		else if (inputState == FeedbackPropertiesMeetRequirementsReport.NOT_MET) {
			return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
		}
		else {
			found = true;
			
			// the partial solution was on the path here. check whether the channel requires
			// certain properties that are met, or whether the channel introduces new properties
			
			// if the plan introduces new global properties, then we can stop looking whether
			// the feedback properties are sufficient to meet the requirements
			if (input.getShipStrategy() != ShipStrategyType.FORWARD && input.getShipStrategy() != ShipStrategyType.NONE) {
				continue;
			}
			
			// first check whether this channel requires something that is not met
			if (input.getRequiredGlobalProps() != null && !input.getRequiredGlobalProps().isMetBy(feedbackGlobal)) {
				return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
			}
			
			// in general, not everything is met here already
			allMet = false;
			
			// if the plan introduces new local properties, we can stop checking for matching local properties
			if (inputState != FeedbackPropertiesMeetRequirementsReport.PENDING_LOCAL_MET) {
				
				if (input.getLocalStrategy() == LocalStrategy.NONE) {
					
					if (input.getRequiredLocalProps() != null && !input.getRequiredLocalProps().isMetBy(feedbackLocal)) {
						return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
					}
					
					allLocallyMet = false;
				}
			}
		}
	}
	
	if (!found) {
		return FeedbackPropertiesMeetRequirementsReport.NO_PARTIAL_SOLUTION;
	} else if (allMet) {
		return FeedbackPropertiesMeetRequirementsReport.MET;
	} else if (allLocallyMet) {
		return FeedbackPropertiesMeetRequirementsReport.PENDING_LOCAL_MET;
	} else {
		return FeedbackPropertiesMeetRequirementsReport.PENDING;
	}
}
 
Example 8
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 4 votes vote down vote up
private void addLocalInfoFromChannelToConfig(Channel channel, TaskConfig config, int inputNum, boolean isBroadcastChannel) {
	// serializer
	if (isBroadcastChannel) {
		config.setBroadcastInputSerializer(channel.getSerializer(), inputNum);
		
		if (channel.getLocalStrategy() != LocalStrategy.NONE || (channel.getTempMode() != null && channel.getTempMode() != TempMode.NONE)) {
			throw new CompilerException("Found local strategy or temp mode on a broadcast variable channel.");
		} else {
			return;
		}
	} else {
		config.setInputSerializer(channel.getSerializer(), inputNum);
	}
	
	// local strategy
	if (channel.getLocalStrategy() != LocalStrategy.NONE) {
		config.setInputLocalStrategy(inputNum, channel.getLocalStrategy());
		if (channel.getLocalStrategyComparator() != null) {
			config.setInputComparator(channel.getLocalStrategyComparator(), inputNum);
		}
	}
	
	assignLocalStrategyResources(channel, config, inputNum);
	
	// materialization / caching
	if (channel.getTempMode() != null) {
		final TempMode tm = channel.getTempMode();

		boolean needsMemory = false;
		// Don't add a pipeline breaker if the data exchange is already blocking, EXCEPT the channel is within an iteration.
		if (tm.breaksPipeline() &&
				(channel.isOnDynamicPath() || channel.getDataExchangeMode() != DataExchangeMode.BATCH) ) {
			config.setInputAsynchronouslyMaterialized(inputNum, true);
			needsMemory = true;
		}
		if (tm.isCached()) {
			config.setInputCached(inputNum, true);
			needsMemory = true;
		}
		
		if (needsMemory) {
			// sanity check
			if (tm == TempMode.NONE || channel.getRelativeTempMemory() <= 0) {
				throw new CompilerException("Bug in compiler: Inconsistent description of input materialization.");
			}
			config.setRelativeInputMaterializationMemory(inputNum, channel.getRelativeTempMemory());
		}
	}
}
 
Example 9
Source File: PlanNode.java    From flink with Apache License 2.0 4 votes vote down vote up
public FeedbackPropertiesMeetRequirementsReport checkPartialSolutionPropertiesMet(PlanNode partialSolution, GlobalProperties feedbackGlobal, LocalProperties feedbackLocal) {
	if (this == partialSolution) {
		return FeedbackPropertiesMeetRequirementsReport.PENDING;
	}
	
	boolean found = false;
	boolean allMet = true;
	boolean allLocallyMet = true;
	
	for (Channel input : getInputs()) {
		FeedbackPropertiesMeetRequirementsReport inputState = input.getSource().checkPartialSolutionPropertiesMet(partialSolution, feedbackGlobal, feedbackLocal);
		
		if (inputState == FeedbackPropertiesMeetRequirementsReport.NO_PARTIAL_SOLUTION) {
			continue;
		}
		else if (inputState == FeedbackPropertiesMeetRequirementsReport.MET) {
			found = true;
			continue;
		}
		else if (inputState == FeedbackPropertiesMeetRequirementsReport.NOT_MET) {
			return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
		}
		else {
			found = true;
			
			// the partial solution was on the path here. check whether the channel requires
			// certain properties that are met, or whether the channel introduces new properties
			
			// if the plan introduces new global properties, then we can stop looking whether
			// the feedback properties are sufficient to meet the requirements
			if (input.getShipStrategy() != ShipStrategyType.FORWARD && input.getShipStrategy() != ShipStrategyType.NONE) {
				continue;
			}
			
			// first check whether this channel requires something that is not met
			if (input.getRequiredGlobalProps() != null && !input.getRequiredGlobalProps().isMetBy(feedbackGlobal)) {
				return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
			}
			
			// in general, not everything is met here already
			allMet = false;
			
			// if the plan introduces new local properties, we can stop checking for matching local properties
			if (inputState != FeedbackPropertiesMeetRequirementsReport.PENDING_LOCAL_MET) {
				
				if (input.getLocalStrategy() == LocalStrategy.NONE) {
					
					if (input.getRequiredLocalProps() != null && !input.getRequiredLocalProps().isMetBy(feedbackLocal)) {
						return FeedbackPropertiesMeetRequirementsReport.NOT_MET;
					}
					
					allLocallyMet = false;
				}
			}
		}
	}
	
	if (!found) {
		return FeedbackPropertiesMeetRequirementsReport.NO_PARTIAL_SOLUTION;
	} else if (allMet) {
		return FeedbackPropertiesMeetRequirementsReport.MET;
	} else if (allLocallyMet) {
		return FeedbackPropertiesMeetRequirementsReport.PENDING_LOCAL_MET;
	} else {
		return FeedbackPropertiesMeetRequirementsReport.PENDING;
	}
}