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

lidongdai pushed a commit to branch dev-1.3.0
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev-1.3.0 by this push:
     new a9da86a  [bug fix] fix bug:2634:Process shows success,when the task of 
the process is killed in the terminal (#2731)
a9da86a is described below

commit a9da86abb4545b1ac8fdc5cdd05e85bdcdffa9c6
Author: bao liang <[email protected]>
AuthorDate: Mon May 18 18:27:16 2020 +0800

    [bug fix] fix bug:2634:Process shows success,when the task of the process 
is killed in the terminal (#2731)
    
    * fix bug: some bugs about worker group from 1.2.0 to 1.3.0
    
    * fix bug: scheduler from 1.2.0 to 1.3.0 do not work
    
    * fix bug: scheduler from 1.2.0 to 1.3.0 do not work
    
    * fix ut bug
    
    * fix bug: Process shows success,when the task of the process is killed in 
the termina
    
    * fix bug #2634: Process shows success,when the task of the process is 
killed in the terminal
    
    Co-authored-by: baoliang <[email protected]>
---
 .../dolphinscheduler/common/enums/ExecutionStatus.java       |  2 +-
 .../server/master/runner/MasterExecThread.java               | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java
index ce141d0..1c336c8 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java
@@ -76,7 +76,7 @@ public enum ExecutionStatus {
   * @return status
   */
    public boolean typeIsFailure(){
-     return this == FAILURE || this == NEED_FAULT_TOLERANCE || this == KILL;
+     return this == FAILURE || this == NEED_FAULT_TOLERANCE;
    }
 
  /**
diff --git 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java
 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java
index 462e30c..6379b32 100644
--- 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java
+++ 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java
@@ -805,7 +805,8 @@ public class MasterExecThread implements Runnable {
         ProcessInstance instance = 
processService.findProcessInstanceById(processInstance.getId());
         ExecutionStatus state = instance.getState();
 
-        if(activeTaskNode.size() > 0 || haveRetryTaskStandBy()){
+        if(activeTaskNode.size() > 0 || retryTaskExists()){
+            // active task and retry task exists
             return runningState(state);
         }
         // process failure
@@ -828,7 +829,8 @@ public class MasterExecThread implements Runnable {
             List<TaskInstance> stopList = 
getCompleteTaskByState(ExecutionStatus.STOP);
             List<TaskInstance> killList = 
getCompleteTaskByState(ExecutionStatus.KILL);
             if(CollectionUtils.isNotEmpty(stopList)
-                    || CollectionUtils.isNotEmpty(killList) || 
!isComplementEnd()){
+                    || CollectionUtils.isNotEmpty(killList)
+                    || !isComplementEnd()){
                 return ExecutionStatus.STOP;
             }else{
                 return ExecutionStatus.SUCCESS;
@@ -837,9 +839,13 @@ public class MasterExecThread implements Runnable {
 
         // success
         if(state == ExecutionStatus.RUNNING_EXEUTION){
+            List<TaskInstance> killTasks = 
getCompleteTaskByState(ExecutionStatus.KILL);
             if(readyToSubmitTaskList.size() > 0){
                 //tasks currently pending submission, no retries, indicating 
that depend is waiting to complete
                 return ExecutionStatus.RUNNING_EXEUTION;
+            }else if(CollectionUtils.isNotEmpty(killTasks)){
+                // tasks maybe killed manually
+                return ExecutionStatus.FAILURE;
             }else{
                 //  if the waiting queue is empty and the status is in 
progress, then success
                 return ExecutionStatus.SUCCESS;
@@ -853,7 +859,7 @@ public class MasterExecThread implements Runnable {
      * whether standby task list have retry tasks
      * @return
      */
-    private boolean haveRetryTaskStandBy() {
+    private boolean retryTaskExists() {
 
         boolean result = false;
 

Reply via email to