org.apache.flink.streaming.api.graph.StreamGraphGenerator Java Examples

The following examples show how to use org.apache.flink.streaming.api.graph.StreamGraphGenerator. 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: ExecutorUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Generate {@link StreamGraph} by {@link StreamGraphGenerator}.
 */
public static StreamGraph generateStreamGraph(
		StreamExecutionEnvironment execEnv,
		List<Transformation<?>> transformations) {
	if (transformations.size() <= 0) {
		throw new IllegalStateException("No operators defined in streaming topology. Cannot generate StreamGraph.");
	}
	StreamGraphGenerator generator =
			new StreamGraphGenerator(transformations, execEnv.getConfig(), execEnv.getCheckpointConfig())
					.setStateBackend(execEnv.getStateBackend())
					.setChaining(execEnv.isChainingEnabled())
					.setUserArtifacts(execEnv.getCachedFiles())
					.setTimeCharacteristic(execEnv.getStreamTimeCharacteristic())
					.setDefaultBufferTimeout(execEnv.getBufferTimeout());
	return generator.generate();
}
 
Example #2
Source File: KeyedStream.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link KeyedStream} using the given {@link KeySelector}
 * to partition operator state by key.
 *
 * @param dataStream
 *            Base stream of data
 * @param keySelector
 *            Function for determining state partitions
 */
public KeyedStream(DataStream<T> dataStream, KeySelector<T, KEY> keySelector, TypeInformation<KEY> keyType) {
	this(
		dataStream,
		new PartitionTransformation<>(
			dataStream.getTransformation(),
			new KeyGroupStreamPartitioner<>(keySelector, StreamGraphGenerator.DEFAULT_LOWER_BOUND_MAX_PARALLELISM)),
		keySelector,
		keyType);
}
 
Example #3
Source File: StreamExecutionEnvironment.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Getter of the {@link org.apache.flink.streaming.api.graph.StreamGraph} of the streaming job.
 *
 * @return The streamgraph representing the transformations
 */
@Internal
public StreamGraph getStreamGraph() {
	if (transformations.size() <= 0) {
		throw new IllegalStateException("No operators defined in streaming topology. Cannot execute.");
	}
	return StreamGraphGenerator.generate(this, transformations);
}
 
Example #4
Source File: StreamTransformation.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the maximum parallelism for this stream transformation.
 *
 * @param maxParallelism Maximum parallelism for this stream transformation.
 */
public void setMaxParallelism(int maxParallelism) {
	Preconditions.checkArgument(maxParallelism > 0
					&& maxParallelism <= StreamGraphGenerator.UPPER_BOUND_MAX_PARALLELISM,
			"Maximum parallelism must be between 1 and " + StreamGraphGenerator.UPPER_BOUND_MAX_PARALLELISM
					+ ". Found: " + maxParallelism);
	this.maxParallelism = maxParallelism;
}
 
Example #5
Source File: KeyedStream.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link KeyedStream} using the given {@link KeySelector}
 * to partition operator state by key.
 *
 * @param dataStream
 *            Base stream of data
 * @param keySelector
 *            Function for determining state partitions
 */
public KeyedStream(DataStream<T> dataStream, KeySelector<T, KEY> keySelector, TypeInformation<KEY> keyType) {
	this(
		dataStream,
		new PartitionTransformation<>(
			dataStream.getTransformation(),
			new KeyGroupStreamPartitioner<>(keySelector, StreamGraphGenerator.DEFAULT_LOWER_BOUND_MAX_PARALLELISM)),
		keySelector,
		keyType);
}
 
Example #6
Source File: StreamExecutionEnvironment.java    From flink with Apache License 2.0 5 votes vote down vote up
private StreamGraphGenerator getStreamGraphGenerator() {
	if (transformations.size() <= 0) {
		throw new IllegalStateException("No operators defined in streaming topology. Cannot execute.");
	}
	return new StreamGraphGenerator(transformations, config, checkpointCfg)
		.setStateBackend(defaultStateBackend)
		.setChaining(isChainingEnabled)
		.setUserArtifacts(cacheFile)
		.setTimeCharacteristic(timeCharacteristic)
		.setDefaultBufferTimeout(bufferTimeout);
}
 
Example #7
Source File: StreamExecutor.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Pipeline createPipeline(List<Transformation<?>> transformations, TableConfig tableConfig, String jobName) {
	if (transformations.size() <= 0) {
		throw new IllegalStateException("No operators defined in streaming topology. Cannot generate StreamGraph.");
	}
	return new StreamGraphGenerator(
		transformations, executionEnvironment.getConfig(), executionEnvironment.getCheckpointConfig())
		.setStateBackend(executionEnvironment.getStateBackend())
		.setChaining(executionEnvironment.isChainingEnabled())
		.setUserArtifacts(executionEnvironment.getCachedFiles())
		.setTimeCharacteristic(executionEnvironment.getStreamTimeCharacteristic())
		.setDefaultBufferTimeout(executionEnvironment.getBufferTimeout())
		.setJobName(jobName)
		.generate();
}
 
Example #8
Source File: KeyedStream.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link KeyedStream} using the given {@link KeySelector}
 * to partition operator state by key.
 *
 * @param dataStream
 *            Base stream of data
 * @param keySelector
 *            Function for determining state partitions
 */
public KeyedStream(DataStream<T> dataStream, KeySelector<T, KEY> keySelector, TypeInformation<KEY> keyType) {
	this(
		dataStream,
		new PartitionTransformation<>(
			dataStream.getTransformation(),
			new KeyGroupStreamPartitioner<>(keySelector, StreamGraphGenerator.DEFAULT_LOWER_BOUND_MAX_PARALLELISM)),
		keySelector,
		keyType);
}
 
Example #9
Source File: StreamExecutionEnvironment.java    From flink with Apache License 2.0 5 votes vote down vote up
private StreamGraphGenerator getStreamGraphGenerator() {
	if (transformations.size() <= 0) {
		throw new IllegalStateException("No operators defined in streaming topology. Cannot execute.");
	}
	return new StreamGraphGenerator(transformations, config, checkpointCfg)
		.setStateBackend(defaultStateBackend)
		.setChaining(isChainingEnabled)
		.setUserArtifacts(cacheFile)
		.setTimeCharacteristic(timeCharacteristic)
		.setDefaultBufferTimeout(bufferTimeout);
}