From d270d22758169431a5d877338aa4f94391426e5e Mon Sep 17 00:00:00 2001 From: ikiler Date: Wed, 31 Jan 2024 14:39:04 +0800 Subject: [PATCH 1/2] Fix deletion failed when the repair task instance does not exist --- .../org/dinky/service/impl/CatalogueServiceImpl.java | 12 +++++++----- .../dinky/service/impl/JobInstanceServiceImpl.java | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java index 57b8cce813..527de56ecb 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java @@ -31,6 +31,7 @@ import org.dinky.data.model.Catalogue; import org.dinky.data.model.Metrics; import org.dinky.data.model.Task; +import org.dinky.data.model.ext.JobInfoDetail; import org.dinky.data.model.job.History; import org.dinky.data.model.job.JobHistory; import org.dinky.data.model.job.JobInstance; @@ -466,13 +467,14 @@ public Result deleteCatalogueById(Integer catalogueId) { throw new BusException(Status.TASK_IS_PUBLISH_CANNOT_DELETE); } if (task.getJobInstanceId() != null) { - // 获取前 先强制刷新一下, 避免获取任务信息状态不准确 - jobInstanceService.refreshJobInfoDetail(task.getJobInstanceId(), true); // 获取当前 job instance JobInstance currentJobInstance = jobInstanceService.getById(task.getJobInstanceId()); - if (currentJobInstance != null - && currentJobInstance.getStatus().equals(JobStatus.RUNNING.getValue())) { - throw new BusException(Status.TASK_IS_RUNNING_CANNOT_DELETE); + if (currentJobInstance != null) { + // 获取前 先强制刷新一下, 避免获取任务信息状态不准确 + JobInfoDetail jobInfoDetail = jobInstanceService.refreshJobInfoDetail(task.getJobInstanceId(), true); + if (jobInfoDetail.getInstance().getStatus().equals(JobStatus.RUNNING.getValue())) { + throw new BusException(Status.TASK_IS_RUNNING_CANNOT_DELETE); + } } } } diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/JobInstanceServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/JobInstanceServiceImpl.java index 6239abc66b..0de903ed38 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/JobInstanceServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/JobInstanceServiceImpl.java @@ -170,7 +170,9 @@ public JobInfoDetail getJobInfoDetailInfo(JobInstance jobInstance) { if (Asserts.isNotNull(history.getClusterConfigurationId())) { ClusterConfiguration clusterConfig = clusterConfigurationService.getClusterConfigById(history.getClusterConfigurationId()); - jobInfoDetail.setClusterConfiguration(ClusterConfigurationDTO.fromBean(clusterConfig)); + if (clusterConfig != null) { + jobInfoDetail.setClusterConfiguration(ClusterConfigurationDTO.fromBean(clusterConfig)); + } } } From fd6bd0ecf0d2e5e4a5f46303ab2d04a75d2a01c9 Mon Sep 17 00:00:00 2001 From: gaoyan1998 Date: Wed, 31 Jan 2024 06:40:02 +0000 Subject: [PATCH 2/2] Spotless Apply --- .../main/java/org/dinky/service/impl/CatalogueServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java index 527de56ecb..5cab6f6538 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java @@ -471,7 +471,8 @@ public Result deleteCatalogueById(Integer catalogueId) { JobInstance currentJobInstance = jobInstanceService.getById(task.getJobInstanceId()); if (currentJobInstance != null) { // 获取前 先强制刷新一下, 避免获取任务信息状态不准确 - JobInfoDetail jobInfoDetail = jobInstanceService.refreshJobInfoDetail(task.getJobInstanceId(), true); + JobInfoDetail jobInfoDetail = + jobInstanceService.refreshJobInfoDetail(task.getJobInstanceId(), true); if (jobInfoDetail.getInstance().getStatus().equals(JobStatus.RUNNING.getValue())) { throw new BusException(Status.TASK_IS_RUNNING_CANNOT_DELETE); }