HomminLee commented on code in PR #14343:
URL: 
https://github.com/apache/dolphinscheduler/pull/14343#discussion_r1255100676


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/SubTaskProcessor.java:
##########
@@ -129,14 +129,29 @@ private void updateTaskState() {
                 subProcessInstance.getId(),
                 subProcessInstance.getState());
         if (subProcessInstance != null && 
subProcessInstance.getState().isFinished()) {
-            // todo: check the status and transform
-            
taskInstance.setState(TaskExecutionStatus.of(subProcessInstance.getState().getCode()));
+            
taskInstance.setState(subProcessFinishedStateTransform(subProcessInstance.getState()));
             taskInstance.setEndTime(new Date());
             dealFinish();
             processService.saveTaskInstance(taskInstance);
         }
     }
 
+    private TaskExecutionStatus 
subProcessFinishedStateTransform(WorkflowExecutionStatus state) {
+        if (state.isSuccess()) {
+            return TaskExecutionStatus.SUCCESS;
+        } else if (state.isFailure()) {
+            return TaskExecutionStatus.FAILURE;
+        } else if (state.isStop()) {
+            return TaskExecutionStatus.KILL;

Review Comment:
   Stop is workflow state, and kill is task state. AFAK, task has no STOP state 
(`TaskExecutionStatus` has STOP state, but it has not been used anywhere). 
`TaskExecutionStatus` has code:
   
   ```
       public boolean isFinished() {
           return isSuccess() || isKill() || isFailure() || isPause();
       }
   ```
   
   Pause workflow has pause task, only kill task state can match stop workflow 
state.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to