This is an automated email from the ASF dual-hosted git repository.

weiraowang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new cb55476235 [Fix-14721] [K8S Task] Handle job delete event when user 
manually delete the job in k8s cluster (#14722)
cb55476235 is described below

commit cb55476235c6a5d5fddfa24f5944e2cc8aeae390
Author: Aaron Wang <[email protected]>
AuthorDate: Fri Aug 11 17:15:07 2023 +0800

    [Fix-14721] [K8S Task] Handle job delete event when user manually delete 
the job in k8s cluster (#14722)
    
    Co-authored-by: Jay Chung <[email protected]>
---
 .../dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
index aecb8b1aac..d799978763 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
@@ -198,7 +198,11 @@ public class K8sTaskExecutor extends 
AbstractK8sTaskExecutor {
                         final LogUtils.MDCAutoClosableContext 
mdcAutoClosableContext =
                                 
LogUtils.setTaskInstanceLogFullPathMDC(taskRequest.getLogPath())) {
                     log.info("event received : job:{} action:{}", 
job.getMetadata().getName(), action);
-                    if (action != Action.ADDED) {
+                    if (action == Action.DELETED) {
+                        log.error("[K8sJobExecutor-{}] fail in k8s", 
job.getMetadata().getName());
+                        taskResponse.setExitStatusCode(EXIT_CODE_FAILURE);
+                        countDownLatch.countDown();
+                    } else if (action != Action.ADDED) {
                         int jobStatus = getK8sJobStatus(job);
                         log.info("job {} status {}", 
job.getMetadata().getName(), jobStatus);
                         if (jobStatus == TaskConstants.RUNNING_CODE) {

Reply via email to