Java Code Examples for org.apache.flink.streaming.api.operators.ChainingStrategy#ALWAYS

The following examples show how to use org.apache.flink.streaming.api.operators.ChainingStrategy#ALWAYS . 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: StreamGraphHasherV2.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private boolean isChainable(StreamEdge edge, boolean isChainingEnabled, StreamGraph streamGraph) {
	StreamNode upStreamVertex = streamGraph.getSourceVertex(edge);
	StreamNode downStreamVertex = streamGraph.getTargetVertex(edge);

	StreamOperator<?> headOperator = upStreamVertex.getOperator();
	StreamOperator<?> outOperator = downStreamVertex.getOperator();

	return downStreamVertex.getInEdges().size() == 1
			&& outOperator != null
			&& headOperator != null
			&& upStreamVertex.isSameSlotSharingGroup(downStreamVertex)
			&& outOperator.getChainingStrategy() == ChainingStrategy.ALWAYS
			&& (headOperator.getChainingStrategy() == ChainingStrategy.HEAD ||
			headOperator.getChainingStrategy() == ChainingStrategy.ALWAYS)
			&& (edge.getPartitioner() instanceof ForwardPartitioner)
			&& upStreamVertex.getParallelism() == downStreamVertex.getParallelism()
			&& isChainingEnabled;
}
 
Example 2
Source File: StreamGraphHasherV2.java    From flink with Apache License 2.0 6 votes vote down vote up
private boolean isChainable(StreamEdge edge, boolean isChainingEnabled, StreamGraph streamGraph) {
	StreamNode upStreamVertex = streamGraph.getSourceVertex(edge);
	StreamNode downStreamVertex = streamGraph.getTargetVertex(edge);

	StreamOperatorFactory<?> headOperator = upStreamVertex.getOperatorFactory();
	StreamOperatorFactory<?> outOperator = downStreamVertex.getOperatorFactory();

	return downStreamVertex.getInEdges().size() == 1
			&& outOperator != null
			&& headOperator != null
			&& upStreamVertex.isSameSlotSharingGroup(downStreamVertex)
			&& outOperator.getChainingStrategy() == ChainingStrategy.ALWAYS
			&& (headOperator.getChainingStrategy() == ChainingStrategy.HEAD ||
			headOperator.getChainingStrategy() == ChainingStrategy.ALWAYS)
			&& (edge.getPartitioner() instanceof ForwardPartitioner)
			&& upStreamVertex.getParallelism() == downStreamVertex.getParallelism()
			&& isChainingEnabled;
}
 
Example 3
Source File: StreamingJobGraphGenerator.java    From flink with Apache License 2.0 6 votes vote down vote up
public static boolean isChainable(StreamEdge edge, StreamGraph streamGraph) {
	StreamNode upStreamVertex = streamGraph.getSourceVertex(edge);
	StreamNode downStreamVertex = streamGraph.getTargetVertex(edge);

	StreamOperatorFactory<?> headOperator = upStreamVertex.getOperatorFactory();
	StreamOperatorFactory<?> outOperator = downStreamVertex.getOperatorFactory();

	return downStreamVertex.getInEdges().size() == 1
			&& outOperator != null
			&& headOperator != null
			&& upStreamVertex.isSameSlotSharingGroup(downStreamVertex)
			&& outOperator.getChainingStrategy() == ChainingStrategy.ALWAYS
			&& (headOperator.getChainingStrategy() == ChainingStrategy.HEAD ||
				headOperator.getChainingStrategy() == ChainingStrategy.ALWAYS)
			&& (edge.getPartitioner() instanceof ForwardPartitioner)
			&& edge.getShuffleMode() != ShuffleMode.BATCH
			&& upStreamVertex.getParallelism() == downStreamVertex.getParallelism()
			&& streamGraph.isChainingEnabled();
}
 
Example 4
Source File: AsyncWaitOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public AsyncWaitOperator(
		AsyncFunction<IN, OUT> asyncFunction,
		long timeout,
		int capacity,
		AsyncDataStream.OutputMode outputMode) {
	super(asyncFunction);
	chainingStrategy = ChainingStrategy.ALWAYS;

	Preconditions.checkArgument(capacity > 0, "The number of concurrent async operation should be greater than 0.");
	this.capacity = capacity;

	this.outputMode = Preconditions.checkNotNull(outputMode, "outputMode");

	this.timeout = timeout;
}
 
Example 5
Source File: FeedbackUnionOperator.java    From flink-statefun with Apache License 2.0 5 votes vote down vote up
FeedbackUnionOperator(
    FeedbackKey<T> feedbackKey,
    SerializableFunction<T, OptionalLong> isBarrierMessage,
    SerializableFunction<T, ?> keySelector,
    long totalMemoryUsedForFeedbackCheckpointing,
    TypeSerializer<T> elementSerializer,
    MailboxExecutor mailboxExecutor) {
  this.feedbackKey = Objects.requireNonNull(feedbackKey);
  this.isBarrierMessage = Objects.requireNonNull(isBarrierMessage);
  this.keySelector = Objects.requireNonNull(keySelector);
  this.totalMemoryUsedForFeedbackCheckpointing = totalMemoryUsedForFeedbackCheckpointing;
  this.elementSerializer = Objects.requireNonNull(elementSerializer);
  this.mailboxExecutor = Objects.requireNonNull(mailboxExecutor);
  this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 6
Source File: FeedbackUnionOperator.java    From stateful-functions with Apache License 2.0 5 votes vote down vote up
FeedbackUnionOperator(
    FeedbackKey<T> feedbackKey,
    SerializablePredicate<T> isBarrierMessage,
    SerializableFunction<T, ?> keySelector,
    long totalMemoryUsedForFeedbackCheckpointing,
    TypeSerializer<T> elementSerializer,
    MailboxExecutor mailboxExecutor) {
  this.feedbackKey = Objects.requireNonNull(feedbackKey);
  this.isBarrierMessage = Objects.requireNonNull(isBarrierMessage);
  this.keySelector = Objects.requireNonNull(keySelector);
  this.totalMemoryUsedForFeedbackCheckpointing = totalMemoryUsedForFeedbackCheckpointing;
  this.elementSerializer = Objects.requireNonNull(elementSerializer);
  this.mailboxExecutor = Objects.requireNonNull(mailboxExecutor);
  this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 7
Source File: WatermarkAssignerOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create a watermark assigner operator.
 * @param rowtimeFieldIndex  the field index to extract event timestamp
 * @param watermarkDelay    the delay by which watermarks are behind the maximum observed timestamp.
 * @param idleTimeout   (idleness checking timeout)
 */
public WatermarkAssignerOperator(int rowtimeFieldIndex, long watermarkDelay, long idleTimeout) {
	this.rowtimeFieldIndex = rowtimeFieldIndex;
	this.watermarkDelay = watermarkDelay;

	this.idleTimeout = idleTimeout;
	this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 8
Source File: MiniBatchedWatermarkAssignerOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public MiniBatchedWatermarkAssignerOperator(
	int rowtimeFieldIndex,
	long watermarkDelay,
	long tzOffset,
	long idleTimeout,
	long watermarkInterval) {
	this.rowtimeFieldIndex = rowtimeFieldIndex;
	this.watermarkDelay = watermarkDelay;
	this.tzOffset = tzOffset;
	this.chainingStrategy = ChainingStrategy.ALWAYS;
	this.watermarkInterval = watermarkInterval;

	this.idleTimeout = idleTimeout;
}
 
Example 9
Source File: AbstractMapBundleOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
AbstractMapBundleOperator(
		MapBundleFunction<K, V, IN, OUT> function,
		BundleTrigger<IN> bundleTrigger) {
	chainingStrategy = ChainingStrategy.ALWAYS;
	this.function = checkNotNull(function, "function is null");
	this.bundleTrigger = checkNotNull(bundleTrigger, "bundleTrigger is null");
}
 
Example 10
Source File: IngressRouterOperator.java    From flink-statefun with Apache License 2.0 4 votes vote down vote up
IngressRouterOperator(StatefulFunctionsConfig configuration, IngressIdentifier<T> id) {
  this.configuration = configuration;
  this.id = Objects.requireNonNull(id);
  this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 11
Source File: IngressRouterOperator.java    From stateful-functions with Apache License 2.0 4 votes vote down vote up
IngressRouterOperator(IngressIdentifier<T> id) {
  this.id = Objects.requireNonNull(id);
  this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 12
Source File: TimestampsAndPunctuatedWatermarksOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
public TimestampsAndPunctuatedWatermarksOperator(AssignerWithPunctuatedWatermarks<T> assigner) {
	super(assigner);
	this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 13
Source File: ExtractTimestampsOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
public ExtractTimestampsOperator(TimestampExtractor<T> extractor) {
	super(extractor);
	chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 14
Source File: TimestampsAndPeriodicWatermarksOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
public TimestampsAndPeriodicWatermarksOperator(AssignerWithPeriodicWatermarks<T> assigner) {
	super(assigner);
	this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 15
Source File: ContinuousFileReaderOperatorITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
TestBoundedOneInputStreamOperator(int expectedProcessedElementCount) {
	// this operator must be chained with ContinuousFileReaderOperator
	// that way, this end input would be triggered after ContinuousFileReaderOperator
	chainingStrategy = ChainingStrategy.ALWAYS;
	this.expectedProcessedElementCount = expectedProcessedElementCount;
}
 
Example 16
Source File: MiniBatchAssignerOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
public MiniBatchAssignerOperator(long intervalMs) {
	this.intervalMs = intervalMs;
	this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 17
Source File: TimestampsAndPunctuatedWatermarksOperator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public TimestampsAndPunctuatedWatermarksOperator(AssignerWithPunctuatedWatermarks<T> assigner) {
	super(assigner);
	this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 18
Source File: ExtractTimestampsOperator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public ExtractTimestampsOperator(TimestampExtractor<T> extractor) {
	super(extractor);
	chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 19
Source File: TimestampsAndPeriodicWatermarksOperator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public TimestampsAndPeriodicWatermarksOperator(AssignerWithPeriodicWatermarks<T> assigner) {
	super(assigner);
	this.chainingStrategy = ChainingStrategy.ALWAYS;
}
 
Example 20
Source File: EventTimeOrderingOperator.java    From flink-connectors with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an event time-based reordering operator.
 */
public EventTimeOrderingOperator() {
    chainingStrategy = ChainingStrategy.ALWAYS;
}