Search in sources :

Example 1 with InputGate

use of org.apache.flink.runtime.io.network.partition.consumer.InputGate in project flink by apache.

the class AbstractReaderTest method createInputGate.

private InputGate createInputGate(int numberOfInputChannels) {
    final InputGate inputGate = mock(InputGate.class);
    when(inputGate.getNumberOfInputChannels()).thenReturn(numberOfInputChannels);
    return inputGate;
}
Also used : InputGate(org.apache.flink.runtime.io.network.partition.consumer.InputGate)

Example 2 with InputGate

use of org.apache.flink.runtime.io.network.partition.consumer.InputGate in project flink by apache.

the class TwoInputStreamTask method init.

@Override
public void init() throws Exception {
    StreamConfig configuration = getConfiguration();
    ClassLoader userClassLoader = getUserCodeClassLoader();
    TypeSerializer<IN1> inputDeserializer1 = configuration.getTypeSerializerIn1(userClassLoader);
    TypeSerializer<IN2> inputDeserializer2 = configuration.getTypeSerializerIn2(userClassLoader);
    int numberOfInputs = configuration.getNumberOfInputs();
    ArrayList<InputGate> inputList1 = new ArrayList<InputGate>();
    ArrayList<InputGate> inputList2 = new ArrayList<InputGate>();
    List<StreamEdge> inEdges = configuration.getInPhysicalEdges(userClassLoader);
    for (int i = 0; i < numberOfInputs; i++) {
        int inputType = inEdges.get(i).getTypeNumber();
        InputGate reader = getEnvironment().getInputGate(i);
        switch(inputType) {
            case 1:
                inputList1.add(reader);
                break;
            case 2:
                inputList2.add(reader);
                break;
            default:
                throw new RuntimeException("Invalid input type number: " + inputType);
        }
    }
    this.inputProcessor = new StreamTwoInputProcessor<>(inputList1, inputList2, inputDeserializer1, inputDeserializer2, this, configuration.getCheckpointMode(), getCheckpointLock(), getEnvironment().getIOManager(), getEnvironment().getTaskManagerInfo().getConfiguration(), getStreamStatusMaintainer(), this.headOperator);
    // make sure that stream tasks report their I/O statistics
    inputProcessor.setMetricGroup(getEnvironment().getMetricGroup().getIOMetricGroup());
}
Also used : ArrayList(java.util.ArrayList) StreamConfig(org.apache.flink.streaming.api.graph.StreamConfig) StreamEdge(org.apache.flink.streaming.api.graph.StreamEdge) InputGate(org.apache.flink.runtime.io.network.partition.consumer.InputGate)

Example 3 with InputGate

use of org.apache.flink.runtime.io.network.partition.consumer.InputGate in project flink by apache.

the class OneInputStreamTask method init.

@Override
public void init() throws Exception {
    StreamConfig configuration = getConfiguration();
    TypeSerializer<IN> inSerializer = configuration.getTypeSerializerIn1(getUserCodeClassLoader());
    int numberOfInputs = configuration.getNumberOfInputs();
    if (numberOfInputs > 0) {
        InputGate[] inputGates = getEnvironment().getAllInputGates();
        inputProcessor = new StreamInputProcessor<>(inputGates, inSerializer, this, configuration.getCheckpointMode(), getCheckpointLock(), getEnvironment().getIOManager(), getEnvironment().getTaskManagerInfo().getConfiguration(), getStreamStatusMaintainer(), this.headOperator);
        // make sure that stream tasks report their I/O statistics
        inputProcessor.setMetricGroup(getEnvironment().getMetricGroup().getIOMetricGroup());
    }
}
Also used : StreamConfig(org.apache.flink.streaming.api.graph.StreamConfig) InputGate(org.apache.flink.runtime.io.network.partition.consumer.InputGate)

Aggregations

InputGate (org.apache.flink.runtime.io.network.partition.consumer.InputGate)3 StreamConfig (org.apache.flink.streaming.api.graph.StreamConfig)2 ArrayList (java.util.ArrayList)1 StreamEdge (org.apache.flink.streaming.api.graph.StreamEdge)1