Java Code Examples for org.apache.flink.optimizer.plan.Channel#getRelativeTempMemory()

The following examples show how to use org.apache.flink.optimizer.plan.Channel#getRelativeTempMemory() . 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: 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 2
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 3
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());
		}
	}
}