gaoyunhaii commented on a change in pull request #8: URL: https://github.com/apache/flink-ml/pull/8#discussion_r735135046
########## File path: flink-ml-iteration/src/main/java/org/apache/flink/iteration/operator/AbstractWrapperOperator.java ########## @@ -0,0 +1,164 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.iteration.operator; + +import org.apache.flink.iteration.IterationRecord; +import org.apache.flink.iteration.broadcast.BroadcastOutput; +import org.apache.flink.iteration.broadcast.BroadcastOutputFactory; +import org.apache.flink.iteration.progresstrack.OperatorEpochWatermarkTracker; +import org.apache.flink.iteration.progresstrack.OperatorEpochWatermarkTrackerFactory; +import org.apache.flink.iteration.progresstrack.OperatorEpochWatermarkTrackerListener; +import org.apache.flink.iteration.proxy.ProxyOutput; +import org.apache.flink.runtime.execution.Environment; +import org.apache.flink.runtime.metrics.groups.InternalOperatorMetricGroup; +import org.apache.flink.runtime.metrics.groups.UnregisteredMetricGroups; +import org.apache.flink.streaming.api.graph.StreamConfig; +import org.apache.flink.streaming.api.operators.Output; +import org.apache.flink.streaming.api.operators.StreamOperator; +import org.apache.flink.streaming.api.operators.StreamOperatorFactory; +import org.apache.flink.streaming.api.operators.StreamOperatorParameters; +import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; +import org.apache.flink.streaming.runtime.tasks.StreamTask; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.Objects; +import java.util.function.Supplier; + +import static org.apache.flink.util.Preconditions.checkState; + +/** The base class of all the wrapper operators. It provides the alignment functionality. */ +public abstract class AbstractWrapperOperator<T> + implements StreamOperator<IterationRecord<T>>, OperatorEpochWatermarkTrackerListener { + + private static final Logger LOG = LoggerFactory.getLogger(AbstractWrapperOperator.class); + + protected final StreamOperatorParameters<IterationRecord<T>> parameters; + + protected final StreamConfig streamConfig; + + protected final StreamTask<?, ?> containingTask; + + protected final Output<StreamRecord<IterationRecord<T>>> output; + + protected final StreamOperatorFactory<T> operatorFactory; + + // --------------- proxy --------------------------- + + protected final ProxyOutput<T> proxyOutput; + + protected final EpochSupplier epochWatermarkSupplier; + + // --------------- Metrics --------------------------- + + /** Metric group for the operator. */ + protected final InternalOperatorMetricGroup metrics; + + // ------------- Iteration Related -------------------- + + protected final OperatorEpochWatermarkTracker epochWatermarkTracker; + + protected final String uniqueSenderId; Review comment: This is a cache to avoid we compute the sender id every time when broadcasting the epoch watermark. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org