You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "zhangshenghang (via GitHub)" <gi...@apache.org> on 2025/02/13 13:46:47 UTC

[PR] [Feature] [Zeta] Client print event which received from jobmaster [seatunnel]

zhangshenghang opened a new pull request, #8696:
URL: https://github.com/apache/seatunnel/pull/8696

   ### Purpose of this pull request
   
   Client print event which received from jobmaster
   
   ### Does this PR introduce _any_ user-facing change?
   
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released SeaTunnel versions or within the unreleased branches such as dev.
   If no, write 'No'.
   If you are adding/modifying connector documents, please follow our new specifications: https://github.com/apache/seatunnel/issues/4544.
   -->
   
   
   ### How was this patch tested?
   
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If you are adding E2E test cases, maybe refer to https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/resources/mysqlcdc_to_mysql.conf, here is a good example.
   -->
   
   
   ### Check list
   
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
     5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
   * [ ] Update the [`release-note`](https://github.com/apache/seatunnel/blob/dev/release-note.md).


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] [Zeta] Client print event which received from jobmaster [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #8696:
URL: https://github.com/apache/seatunnel/pull/8696#discussion_r1960915370


##########
config/seatunnel.yaml:
##########
@@ -23,6 +23,8 @@ seatunnel:
     queue-type: blockingqueue
     print-execution-info-interval: 60
     print-job-metrics-info-interval: 60
+    print-job-event-info-interval: 30
+    event-queue-size: 100

Review Comment:
   ```suggestion
       job-event-queue-size: 100
   ```



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] [Zeta] Client print event which received from jobmaster [seatunnel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8696:
URL: https://github.com/apache/seatunnel/pull/8696#issuecomment-4130790819

   This pull request has been closed because it has not had recent activity. You could reopen it if you try to continue your work, and anyone who are interested in it are encouraged to continue work on this pull request.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] [Zeta] Client print event which received from jobmaster [seatunnel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8696:
URL: https://github.com/apache/seatunnel/pull/8696#issuecomment-4086695028

   This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 7 days if no further activity occurs.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] [Zeta] Client print event which received from jobmaster [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #8696:
URL: https://github.com/apache/seatunnel/pull/8696#discussion_r2191564115


##########
seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/ClientExecuteCommand.java:
##########
@@ -227,6 +239,9 @@ public void execute() throws CommandExecuteException {
         } catch (Exception e) {
             throw new CommandExecuteException("SeaTunnel job executed failed", e);
         } finally {
+
+            printEvent(jobId);
+

Review Comment:
   Thanks @zhangshenghang . Let's add an option to disable print event by default. User can print event if them need when submit job by shell.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] [Zeta] Client print event which received from jobmaster [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #8696:
URL: https://github.com/apache/seatunnel/pull/8696#issuecomment-2665253549

   cc @hailin0 


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] [Zeta] Client print event which received from jobmaster [seatunnel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #8696: [Feature] [Zeta] Client print event which received from jobmaster
URL: https://github.com/apache/seatunnel/pull/8696


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] [Zeta] Client print event which received from jobmaster [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org