This is an automated email from the ASF dual-hosted git repository.

tyrantlucifer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new 87a4fa69d5 [Hotfix][Zeta] Avoid Redundant Job Submissions by Checking 
Job Status (#5229)
87a4fa69d5 is described below

commit 87a4fa69d5abc30d9abdf3f5c6215df6e7a3ae89
Author: ic4y <[email protected]>
AuthorDate: Wed Aug 9 20:20:10 2023 +0800

    [Hotfix][Zeta] Avoid Redundant Job Submissions by Checking Job Status 
(#5229)
---
 .../apache/seatunnel/engine/server/CoordinatorService.java   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java
 
b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java
index ced00d9e66..fde8b3744c 100644
--- 
a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java
+++ 
b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java
@@ -425,6 +425,18 @@ public class CoordinatorService {
     /** call by client to submit job */
     public PassiveCompletableFuture<Void> submitJob(long jobId, Data 
jobImmutableInformation) {
         CompletableFuture<Void> jobSubmitFuture = new CompletableFuture<>();
+
+        // Check if the current jobID is already running. If so, complete the 
submission
+        // successfully.
+        // This avoids potential issues like redundant job restores or other 
anomalies.
+        if (getJobMaster(jobId) != null) {
+            logger.warning(
+                    String.format(
+                            "The job %s is currently running; no need to 
submit again.", jobId));
+            jobSubmitFuture.complete(null);
+            return new PassiveCompletableFuture<>(jobSubmitFuture);
+        }
+
         JobMaster jobMaster =
                 new JobMaster(
                         jobImmutableInformation,

Reply via email to