Search in sources :

Example 1 with SourceInputConfig

use of org.apache.flink.streaming.api.graph.StreamConfig.SourceInputConfig in project flink by apache.

the class StreamTaskMailboxTestHarnessBuilder method initializeSourceInput.

private SourceInputConfig initializeSourceInput(int inputId, SourceInputConfigPlaceHolder sourceInput, StreamNode mainNode) {
    Map<Integer, StreamConfig> transitiveChainedTaskConfigs = streamConfig.getTransitiveChainedTaskConfigs(getClass().getClassLoader());
    Integer maxNodeId = transitiveChainedTaskConfigs.isEmpty() ? StreamConfigChainer.MAIN_NODE_ID : Collections.max(transitiveChainedTaskConfigs.keySet());
    List<StreamEdge> outEdgesInOrder = new LinkedList<>();
    StreamEdge sourceToMainEdge = new StreamEdge(new StreamNode(maxNodeId + inputId + 1337, null, null, (StreamOperator<?>) null, null, null), mainNode, 0, new ForwardPartitioner<>(), null);
    outEdgesInOrder.add(sourceToMainEdge);
    StreamConfig sourceConfig = new StreamConfig(new Configuration());
    sourceConfig.setTimeCharacteristic(streamConfig.getTimeCharacteristic());
    sourceConfig.setOutEdgesInOrder(outEdgesInOrder);
    sourceConfig.setChainedOutputs(outEdgesInOrder);
    sourceConfig.setTypeSerializerOut(sourceInput.getSourceSerializer());
    sourceConfig.setOperatorID(sourceInput.getOperatorId());
    sourceConfig.setStreamOperatorFactory(sourceInput.getSourceOperatorFactory());
    transitiveChainedTaskConfigs.put(sourceToMainEdge.getSourceId(), sourceConfig);
    streamConfig.setTransitiveChainedTaskConfigs(transitiveChainedTaskConfigs);
    return new SourceInputConfig(sourceToMainEdge);
}
Also used : BufferDebloatConfiguration(org.apache.flink.runtime.throughput.BufferDebloatConfiguration) Configuration(org.apache.flink.configuration.Configuration) SourceInputConfig(org.apache.flink.streaming.api.graph.StreamConfig.SourceInputConfig) StreamConfig(org.apache.flink.streaming.api.graph.StreamConfig) StreamEdge(org.apache.flink.streaming.api.graph.StreamEdge) StreamNode(org.apache.flink.streaming.api.graph.StreamNode) StreamOperator(org.apache.flink.streaming.api.operators.StreamOperator) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 Configuration (org.apache.flink.configuration.Configuration)1 BufferDebloatConfiguration (org.apache.flink.runtime.throughput.BufferDebloatConfiguration)1 StreamConfig (org.apache.flink.streaming.api.graph.StreamConfig)1 SourceInputConfig (org.apache.flink.streaming.api.graph.StreamConfig.SourceInputConfig)1 StreamEdge (org.apache.flink.streaming.api.graph.StreamEdge)1 StreamNode (org.apache.flink.streaming.api.graph.StreamNode)1 StreamOperator (org.apache.flink.streaming.api.operators.StreamOperator)1