Skip to content

Commit

Permalink
[Fix]Fix deletion task failed when the job instance does not exist (#…
Browse files Browse the repository at this point in the history
…3107)

Co-authored-by: gaoyan1998 <[email protected]>
  • Loading branch information
gaoyan1998 and gaoyan1998 authored Jan 31, 2024
1 parent 05d3f60 commit e5f21db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -466,13 +467,15 @@ public Result<Void> 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);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}

Expand Down

0 comments on commit e5f21db

Please sign in to comment.