Java Code Examples for org.apache.flink.streaming.api.graph.StreamConfig#getTypeSerializerIn1()
The following examples show how to use
org.apache.flink.streaming.api.graph.StreamConfig#getTypeSerializerIn1() .
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: FeedbackUnionOperatorFactory.java From stateful-functions with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public <T extends StreamOperator<E>> T createStreamOperator( StreamTask<?, ?> containingTask, StreamConfig config, Output<StreamRecord<E>> output) { final TypeSerializer<E> serializer = config.getTypeSerializerIn1(containingTask.getUserCodeClassLoader()); final long totalMemoryUsedForFeedbackCheckpointing = config .getConfiguration() .getInteger(FeedbackConfiguration.TOTAL_MEMORY_USED_FOR_FEEDBACK_CHECKPOINTING); FeedbackUnionOperator<E> op = new FeedbackUnionOperator<>( feedbackKey, isBarrierMessage, keySelector, totalMemoryUsedForFeedbackCheckpointing, serializer, mailboxExecutor); op.setup(containingTask, config, output); return (T) op; }
Example 2
Source File: FeedbackUnionOperatorFactory.java From flink-statefun with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public <T extends StreamOperator<E>> T createStreamOperator( StreamTask<?, ?> containingTask, StreamConfig config, Output<StreamRecord<E>> output) { final TypeSerializer<E> serializer = config.getTypeSerializerIn1(containingTask.getUserCodeClassLoader()); FeedbackUnionOperator<E> op = new FeedbackUnionOperator<>( feedbackKey, isBarrierMessage, keySelector, configuration.getFeedbackBufferSize().getBytes(), serializer, mailboxExecutor); op.setup(containingTask, config, output); return (T) op; }
Example 3
Source File: OneInputStreamTask.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@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, getEnvironment().getMetricGroup().getIOMetricGroup(), inputWatermarkGauge); } headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge::getValue); }
Example 4
Source File: OperatorChain.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private <IN, OUT> WatermarkGaugeExposingOutput<StreamRecord<IN>> createChainedOperator( StreamTask<?, ?> containingTask, StreamConfig operatorConfig, Map<Integer, StreamConfig> chainedConfigs, ClassLoader userCodeClassloader, Map<StreamEdge, RecordWriterOutput<?>> streamOutputs, List<StreamOperator<?>> allOperators, OutputTag<IN> outputTag) { // create the output that the operator writes to first. this may recursively create more operators WatermarkGaugeExposingOutput<StreamRecord<OUT>> chainedOperatorOutput = createOutputCollector( containingTask, operatorConfig, chainedConfigs, userCodeClassloader, streamOutputs, allOperators); // now create the operator and give it the output collector to write its output to OneInputStreamOperator<IN, OUT> chainedOperator = operatorConfig.getStreamOperator(userCodeClassloader); chainedOperator.setup(containingTask, operatorConfig, chainedOperatorOutput); allOperators.add(chainedOperator); WatermarkGaugeExposingOutput<StreamRecord<IN>> currentOperatorOutput; if (containingTask.getExecutionConfig().isObjectReuseEnabled()) { currentOperatorOutput = new ChainingOutput<>(chainedOperator, this, outputTag); } else { TypeSerializer<IN> inSerializer = operatorConfig.getTypeSerializerIn1(userCodeClassloader); currentOperatorOutput = new CopyingChainingOutput<>(chainedOperator, inSerializer, outputTag, this); } // wrap watermark gauges since registered metrics must be unique chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, currentOperatorOutput.getWatermarkGauge()::getValue); chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_OUTPUT_WATERMARK, chainedOperatorOutput.getWatermarkGauge()::getValue); return currentOperatorOutput; }
Example 5
Source File: OneInputStreamTask.java From flink with Apache License 2.0 | 5 votes |
@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 StreamOneInputProcessor<>( inputGates, inSerializer, this, configuration.getCheckpointMode(), getCheckpointLock(), getEnvironment().getIOManager(), getEnvironment().getTaskManagerInfo().getConfiguration(), getStreamStatusMaintainer(), this.headOperator, getEnvironment().getMetricGroup().getIOMetricGroup(), inputWatermarkGauge, getTaskNameWithSubtaskAndId(), operatorChain); } headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge::getValue); }
Example 6
Source File: AbstractTwoInputStreamTask.java From flink with Apache License 2.0 | 5 votes |
@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); } } createInputProcessor(inputList1, inputList2, inputDeserializer1, inputDeserializer2); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_1_WATERMARK, input1WatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_2_WATERMARK, input2WatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge::getValue); }
Example 7
Source File: OperatorChain.java From flink with Apache License 2.0 | 5 votes |
private <IN, OUT> WatermarkGaugeExposingOutput<StreamRecord<IN>> createChainedOperator( StreamTask<?, ?> containingTask, StreamConfig operatorConfig, Map<Integer, StreamConfig> chainedConfigs, ClassLoader userCodeClassloader, Map<StreamEdge, RecordWriterOutput<?>> streamOutputs, List<StreamOperator<?>> allOperators, OutputTag<IN> outputTag) { // create the output that the operator writes to first. this may recursively create more operators WatermarkGaugeExposingOutput<StreamRecord<OUT>> chainedOperatorOutput = createOutputCollector( containingTask, operatorConfig, chainedConfigs, userCodeClassloader, streamOutputs, allOperators); // now create the operator and give it the output collector to write its output to StreamOperatorFactory<OUT> chainedOperatorFactory = operatorConfig.getStreamOperatorFactory(userCodeClassloader); OneInputStreamOperator<IN, OUT> chainedOperator = chainedOperatorFactory.createStreamOperator( containingTask, operatorConfig, chainedOperatorOutput); allOperators.add(chainedOperator); WatermarkGaugeExposingOutput<StreamRecord<IN>> currentOperatorOutput; if (containingTask.getExecutionConfig().isObjectReuseEnabled()) { currentOperatorOutput = new ChainingOutput<>(chainedOperator, this, outputTag); } else { TypeSerializer<IN> inSerializer = operatorConfig.getTypeSerializerIn1(userCodeClassloader); currentOperatorOutput = new CopyingChainingOutput<>(chainedOperator, inSerializer, outputTag, this); } // wrap watermark gauges since registered metrics must be unique chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, currentOperatorOutput.getWatermarkGauge()::getValue); chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_OUTPUT_WATERMARK, chainedOperatorOutput.getWatermarkGauge()::getValue); return currentOperatorOutput; }
Example 8
Source File: AbstractTwoInputStreamTask.java From flink with Apache License 2.0 | 5 votes |
@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<IndexedInputGate> inputList1 = new ArrayList<>(); ArrayList<IndexedInputGate> inputList2 = new ArrayList<>(); List<StreamEdge> inEdges = configuration.getInPhysicalEdges(userClassLoader); for (int i = 0; i < numberOfInputs; i++) { int inputType = inEdges.get(i).getTypeNumber(); IndexedInputGate 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); } } createInputProcessor(inputList1, inputList2, inputDeserializer1, inputDeserializer2); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_1_WATERMARK, input1WatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_2_WATERMARK, input2WatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge::getValue); }
Example 9
Source File: TwoInputStreamTask.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@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, getEnvironment().getMetricGroup().getIOMetricGroup(), input1WatermarkGauge, input2WatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_1_WATERMARK, input1WatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_2_WATERMARK, input2WatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge::getValue); }
Example 10
Source File: OperatorChain.java From flink with Apache License 2.0 | 4 votes |
private <IN, OUT> WatermarkGaugeExposingOutput<StreamRecord<IN>> createChainedOperator( StreamTask<OUT, ?> containingTask, StreamConfig operatorConfig, Map<Integer, StreamConfig> chainedConfigs, ClassLoader userCodeClassloader, Map<StreamEdge, RecordWriterOutput<?>> streamOutputs, List<StreamOperatorWrapper<?, ?>> allOperatorWrappers, OutputTag<IN> outputTag, MailboxExecutorFactory mailboxExecutorFactory) { // create the output that the operator writes to first. this may recursively create more operators WatermarkGaugeExposingOutput<StreamRecord<OUT>> chainedOperatorOutput = createOutputCollector( containingTask, operatorConfig, chainedConfigs, userCodeClassloader, streamOutputs, allOperatorWrappers, mailboxExecutorFactory); // now create the operator and give it the output collector to write its output to Tuple2<OneInputStreamOperator<IN, OUT>, Optional<ProcessingTimeService>> chainedOperatorAndTimeService = StreamOperatorFactoryUtil.createOperator( operatorConfig.getStreamOperatorFactory(userCodeClassloader), containingTask, operatorConfig, chainedOperatorOutput, operatorEventDispatcher); OneInputStreamOperator<IN, OUT> chainedOperator = chainedOperatorAndTimeService.f0; allOperatorWrappers.add(createOperatorWrapper(chainedOperator, containingTask, operatorConfig, chainedOperatorAndTimeService.f1)); WatermarkGaugeExposingOutput<StreamRecord<IN>> currentOperatorOutput; if (containingTask.getExecutionConfig().isObjectReuseEnabled()) { currentOperatorOutput = new ChainingOutput<>(chainedOperator, this, outputTag); } else { TypeSerializer<IN> inSerializer = operatorConfig.getTypeSerializerIn1(userCodeClassloader); currentOperatorOutput = new CopyingChainingOutput<>(chainedOperator, inSerializer, outputTag, this); } // wrap watermark gauges since registered metrics must be unique chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, currentOperatorOutput.getWatermarkGauge()::getValue); chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_OUTPUT_WATERMARK, chainedOperatorOutput.getWatermarkGauge()::getValue); return currentOperatorOutput; }