From 7037027e122f631d6d918edf93c2b37ba20f0ef7 Mon Sep 17 00:00:00 2001 From: Calvin Kirs Date: Tue, 28 Nov 2023 18:05:42 +0800 Subject: [PATCH] [Feature](job)support cancel task and fix log invalid Running task can be show and fix cancel fail --- .../java/org/apache/doris/job/manager/JobManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java b/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java index a6142b7cf3932e0..b2d18da5d701d18 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java @@ -192,11 +192,14 @@ public void replayDeleteJob(T job) { .add("msg", "replay delete scheduler job").build()); } - void cancelTask(Long jobId, Long taskId) throws JobException { - checkJobExist(jobId); - if (null == jobMap.get(jobId).getRunningTasks()) { - throw new JobException("task not exist,taskId:" + taskId); + public void cancelTaskById(String jobName, Long taskId) throws JobException { + for (T job : jobMap.values()) { + if (job.getJobName().equals(jobName)) { + job.cancelTaskById(taskId); + return; + } } + throw new JobException("job not exist,jobName:" + jobName); } @Override