Search in sources :

Example 1 with NetworkInputConfig

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

the class StreamTaskMailboxTestHarnessBuilder method initializeInputs.

protected void initializeInputs(StreamMockEnvironment streamMockEnvironment) {
    inputGates = new StreamTestSingleInputGate[inputChannelsPerGate.size()];
    List<StreamEdge> inPhysicalEdges = new LinkedList<>();
    StreamNode mainNode = new StreamNode(StreamConfigChainer.MAIN_NODE_ID, null, null, (StreamOperator<?>) null, null, null);
    for (int i = 0; i < inputs.size(); i++) {
        if ((inputs.get(i) instanceof NetworkInputConfig)) {
            NetworkInputConfig networkInput = (NetworkInputConfig) inputs.get(i);
            initializeNetworkInput(networkInput, mainNode, streamMockEnvironment, inPhysicalEdges);
        } else if ((inputs.get(i) instanceof StreamTaskMailboxTestHarnessBuilder.SourceInputConfigPlaceHolder)) {
            SourceInputConfigPlaceHolder sourceInput = (SourceInputConfigPlaceHolder) inputs.get(i);
            inputs.set(i, initializeSourceInput(i, sourceInput, mainNode));
        } else {
            throw new UnsupportedOperationException("Unknown input type " + inputs.get(i));
        }
    }
    streamConfig.setInPhysicalEdges(inPhysicalEdges);
    streamConfig.setNumberOfNetworkInputs(inputGates.length);
    streamConfig.setInputs(inputs.toArray(new InputConfig[inputs.size()]));
}
Also used : NetworkInputConfig(org.apache.flink.streaming.api.graph.StreamConfig.NetworkInputConfig) StreamEdge(org.apache.flink.streaming.api.graph.StreamEdge) StreamNode(org.apache.flink.streaming.api.graph.StreamNode) NetworkInputConfig(org.apache.flink.streaming.api.graph.StreamConfig.NetworkInputConfig) InputConfig(org.apache.flink.streaming.api.graph.StreamConfig.InputConfig) SourceInputConfig(org.apache.flink.streaming.api.graph.StreamConfig.SourceInputConfig) LinkedList(java.util.LinkedList)

Example 2 with NetworkInputConfig

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

the class StreamTaskMailboxTestHarnessBuilder method addInput.

public StreamTaskMailboxTestHarnessBuilder<OUT> addInput(TypeInformation<?> inputType, int inputChannels, @Nullable KeySelector<?, ?> keySelector) {
    streamConfig.setStatePartitioner(inputs.size(), keySelector);
    inputs.add(new NetworkInputConfig(inputType.createSerializer(executionConfig), inputChannelsPerGate.size()));
    inputChannelsPerGate.add(inputChannels);
    return this;
}
Also used : NetworkInputConfig(org.apache.flink.streaming.api.graph.StreamConfig.NetworkInputConfig)

Aggregations

NetworkInputConfig (org.apache.flink.streaming.api.graph.StreamConfig.NetworkInputConfig)2 LinkedList (java.util.LinkedList)1 InputConfig (org.apache.flink.streaming.api.graph.StreamConfig.InputConfig)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