Hisoka-X commented on code in PR #8696:
URL: https://github.com/apache/seatunnel/pull/8696#discussion_r1964742072


##########
docs/en/seatunnel-engine/rest-api-v1.md:
##########
@@ -843,4 +843,46 @@ Returns a list of logs from the requested node.
 To get a list of logs from the current node: 
`http://localhost:5801/hazelcast/rest/maps/log`
 To get the content of a log file: 
`http://localhost:5801/hazelcast/rest/maps/log/job-898380162133917698.log`
 
+</details>
+
+------------------------------------------------------------------------------------------

Review Comment:
   Let's not add new feature for V1. Because it already be depreacated.



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:
##########
@@ -142,6 +144,8 @@ public class JobMaster {
 
     private SeaTunnelServer seaTunnelServer;
 
+    @Getter private ArrayBlockingQueue<Event> events;
+    @Getter private ArrayBlockingQueue<Event> historyEvents;

Review Comment:
   Why need two `ArrayBlockingQueue`?



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/operation/GetEventOperation.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * 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.operation;
+
+import org.apache.seatunnel.api.event.Event;
+import org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException;
+import org.apache.seatunnel.engine.common.utils.concurrent.CompletableFuture;
+import org.apache.seatunnel.engine.server.CoordinatorService;
+import org.apache.seatunnel.engine.server.SeaTunnelServer;
+import org.apache.seatunnel.engine.server.master.JobMaster;
+import 
org.apache.seatunnel.engine.server.serializable.ResourceDataSerializerHook;
+
+import com.hazelcast.internal.serialization.Data;
+import com.hazelcast.nio.ObjectDataInput;
+import com.hazelcast.nio.ObjectDataOutput;
+import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
+import com.hazelcast.spi.impl.operationservice.Operation;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+
+@Slf4j
+public class GetEventOperation extends Operation implements 
IdentifiedDataSerializable {
+
+    private Long jobId;
+
+    private Boolean isAll;
+
+    private List<Event> events = new ArrayList<>();
+
+    public GetEventOperation() {}
+
+    private Data response;
+
+    /**
+     * @param jobId job id
+     * @param isAll When isAll is true, retrieve all events; otherwise, 
retrieve the latest event
+     */
+    public GetEventOperation(Long jobId, boolean isAll) {
+        this.jobId = jobId;
+        this.isAll = isAll;
+    }
+
+    @Override
+    public void run() throws Exception {
+        if (jobId == null) {
+            throw new SeaTunnelEngineException("JobId cannot be null");
+        }
+        SeaTunnelServer server = getService();
+        CoordinatorService coordinatorService = server.getCoordinatorService();
+
+        try {
+            response =
+                    CompletableFuture.supplyAsync(
+                                    () -> retrieveEvents(coordinatorService),
+                                    getNodeEngine()
+                                            .getExecutionService()
+                                            
.getExecutor("get_event_operation"))

Review Comment:
   Please do not use new executor to do this. You can just use Executor in 
org.apache.seatunnel.engine.common.utils.concurrent.CompletableFuture



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:
##########
@@ -150,8 +154,10 @@ public class CoordinatorService {
      * key: job id; <br>
      * value: job master;
      */
-    private final Map<Long, JobMaster> runningJobMasterMap = new 
ConcurrentHashMap<>();
+    @Getter private final Map<Long, JobMaster> runningJobMasterMap = new 
ConcurrentHashMap<>();
 
+    @Getter @Setter
+    private Map<Long, ArrayBlockingQueue<Event>> jobEventMap = new 
ConcurrentHashMap<>();

Review Comment:
   put `ArrayBlockingQueue<Event>` into JobMaster?



-- 
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]

Reply via email to