Skip to content

Commit

Permalink
[fix] fix get job metrics get NPE (#8093)
Browse files Browse the repository at this point in the history
  • Loading branch information
liunaijie authored Nov 29, 2024
1 parent 9a5da78 commit 18b2496
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ seatunnel:
metric:
enabled: false
logs:
scheduled-deletion-enable: true
scheduled-deletion-enable: false
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ public PassiveCompletableFuture<Void> submitJob(
() -> {
try {
if (!isStartWithSavePoint
&& getJobHistoryService().getJobMetrics(jobId) != null) {
&& getJobHistoryService().getJobMetrics(jobId)
!= JobMetrics.empty()) {
throw new JobException(
String.format(
"The job id %s has already been submitted and is not starting with a savepoint.",
Expand Down Expand Up @@ -779,7 +780,7 @@ public JobMetrics getJobMetrics(long jobId) {
}
JobMetrics jobMetrics = JobMetricsUtil.toJobMetrics(runningJobMaster.getCurrJobMetrics());
JobMetrics jobMetricsImap = jobHistoryService.getJobMetrics(jobId);
return jobMetricsImap != null ? jobMetricsImap.merge(jobMetrics) : jobMetrics;
return jobMetricsImap != JobMetrics.empty() ? jobMetricsImap.merge(jobMetrics) : jobMetrics;
}

public Map<Long, JobMetrics> getRunningJobMetrics() {
Expand Down Expand Up @@ -831,7 +832,7 @@ public Map<Long, JobMetrics> getRunningJobMetrics() {
longJobMetricsMap.forEach(
(jobId, jobMetrics) -> {
JobMetrics jobMetricsImap = jobHistoryService.getJobMetrics(jobId);
if (jobMetricsImap != null) {
if (jobMetricsImap != JobMetrics.empty()) {
longJobMetricsMap.put(jobId, jobMetricsImap.merge(jobMetrics));
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public JobState getJobDetailState(Long jobId) {
}

public JobMetrics getJobMetrics(Long jobId) {
return finishedJobMetricsImap.getOrDefault(jobId, null);
return finishedJobMetricsImap.getOrDefault(jobId, JobMetrics.empty());
}

public JobDAGInfo getJobDAGInfo(Long jobId) {
Expand Down

0 comments on commit 18b2496

Please sign in to comment.