Hisoka-X commented on code in PR #2386:
URL:
https://github.com/apache/incubator-seatunnel/pull/2386#discussion_r944513813
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/SinkAggregatedCommitterTask.java:
##########
@@ -17,20 +17,64 @@
package org.apache.seatunnel.engine.server.task;
+import org.apache.seatunnel.api.sink.SinkAggregatedCommitter;
import org.apache.seatunnel.engine.core.dag.actions.SinkAction;
+import org.apache.seatunnel.engine.server.execution.TaskLocation;
+
+import com.hazelcast.cluster.Address;
+import com.hazelcast.logging.ILogger;
+import com.hazelcast.logging.Logger;
import java.net.URL;
+import java.util.Arrays;
import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
-public class SinkAggregatedCommitterTask extends CoordinatorTask {
+public class SinkAggregatedCommitterTask<AggregatedCommitInfoT> extends
CoordinatorTask {
+ private static final ILogger LOGGER =
Logger.getLogger(SinkAggregatedCommitterTask.class);
private static final long serialVersionUID = 5906594537520393503L;
- private final SinkAction<?, ?, ?, ?> sink;
+ private final SinkAction<?, ?, ?, AggregatedCommitInfoT> sink;
+
+ private final SinkAggregatedCommitter<?, AggregatedCommitInfoT>
aggregatedCommitter;
+
+ private final Map<Long, Address> writerAddressMap;
+
+ private final Map<Long, List<AggregatedCommitInfoT>>
checkpointCommitInfoMap;
- public SinkAggregatedCommitterTask(long taskID, SinkAction<?, ?, ?, ?>
sink) {
- super(taskID);
+ public SinkAggregatedCommitterTask(long jobID, TaskLocation taskID,
SinkAction<?, ?, ?, AggregatedCommitInfoT> sink,
+ SinkAggregatedCommitter<?,
AggregatedCommitInfoT> aggregatedCommitter) {
+ super(jobID, taskID);
this.sink = sink;
+ this.aggregatedCommitter = aggregatedCommitter;
+ this.writerAddressMap = new ConcurrentHashMap<>();
+ this.checkpointCommitInfoMap = new ConcurrentHashMap<>();
+ }
+
+ @Override
+ public void init() throws Exception {
+ super.init();
+ LOGGER.info("starting seatunnel source split enumerator task, sink
name: " + sink.getName());
Review Comment:
My fault, fixed it.
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/TransformSeaTunnelTask.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.seatunnel.engine.server.task;
+
+import org.apache.seatunnel.api.table.type.Record;
+import org.apache.seatunnel.api.transform.Collector;
+import org.apache.seatunnel.engine.core.dag.actions.SourceAction;
+import org.apache.seatunnel.engine.server.dag.physical.config.SourceConfig;
+import org.apache.seatunnel.engine.server.dag.physical.flow.Flow;
+import org.apache.seatunnel.engine.server.execution.ProgressState;
+import org.apache.seatunnel.engine.server.execution.TaskLocation;
+import org.apache.seatunnel.engine.server.task.flow.OneOutputFlowLifeCycle;
+import org.apache.seatunnel.engine.server.task.flow.SourceFlowLifeCycle;
+
+import com.hazelcast.logging.ILogger;
+import com.hazelcast.logging.Logger;
+import lombok.NonNull;
+
+public class TransformSeaTunnelTask extends SeaTunnelTask {
+
+ private static final ILogger LOGGER =
Logger.getLogger(TransformSeaTunnelTask.class);
+
+ public TransformSeaTunnelTask(long jobID, TaskLocation taskID, int
indexID, Flow executionFlow) {
+ super(jobID, taskID, indexID, executionFlow);
+ }
+
+ private Collector<Record> collector;
+
+ @Override
+ public void init() throws Exception {
+ super.init();
+ LOGGER.info("starting seatunnel transform task, index " + indexID);
+ collector = new SeaTunnelTransformCollector<>(outputs);
+ }
+
+ @Override
+ protected SourceFlowLifeCycle<?, ?>
createSourceFlowLifeCycle(SourceAction<?, ?, ?> sourceAction,
+ SourceConfig
config) {
+ throw new UnsupportedOperationException("MiddleSeaTunnelTask can't
create SourceFlowLifeCycle");
+ }
+
+ @NonNull
+ @Override
+ @SuppressWarnings("unchecked")
+ public ProgressState call() throws Exception {
+ if (startFlowLifeCycle instanceof OneOutputFlowLifeCycle) {
Review Comment:
Done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]