From 0842ec24aae7bc97190f6663408c728f782acda4 Mon Sep 17 00:00:00 2001 From: ic4y <83933160+ic4y@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:08:53 +0800 Subject: [PATCH] [bugfix][zeta] Fix the issue of two identical IDs appearing when executing seatunnel.sh -l as the job resumes (#5191) --- .../engine/server/master/JobHistoryService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobHistoryService.java b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobHistoryService.java index 12dcae40ca7..dda9a2d0f3f 100644 --- a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobHistoryService.java +++ b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobHistoryService.java @@ -42,7 +42,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; import java.util.stream.Stream; public class JobHistoryService { @@ -101,10 +103,15 @@ public JobHistoryService( // Gets the status of a running and completed job public String listAllJob() { List status = new ArrayList<>(); + Set runningJonIds = + runningJobMasterMap.values().stream() + .map(master -> master.getJobImmutableInformation().getJobId()) + .collect(Collectors.toSet()); Stream.concat( runningJobMasterMap.values().stream() .map(master -> toJobStateMapper(master, true)), - finishedJobStateImap.values().stream()) + finishedJobStateImap.values().stream() + .filter(jobState -> !runningJonIds.contains(jobState.getJobId()))) .forEach( jobState -> { JobStatusData jobStatusData =