ruanwenjun commented on code in PR #16980:
URL: 
https://github.com/apache/dolphinscheduler/pull/16980#discussion_r1926627087


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/statemachine/TaskFailureStateAction.java:
##########
@@ -130,6 +130,17 @@ public void killEventAction(final 
IWorkflowExecutionRunnable workflowExecutionRu
                                 final ITaskExecutionRunnable 
taskExecutionRunnable,
                                 final TaskKillLifecycleEvent taskKillEvent) {
         throwExceptionIfStateIsNotMatch(taskExecutionRunnable);
+        final IWorkflowExecutionGraph workflowExecutionGraph = 
taskExecutionRunnable.getWorkflowExecutionGraph();
+        // for now, killEventAction can be fired on failure with retry
+        // there is no task executor now, shouldn't call 
workflowExecutionGraph.isTaskExecutionRunnableActive()
+        // it's better to call super.killedEventAction() direct
+        if (taskExecutionRunnable.isTaskInstanceCanRetry()
+        // && 
workflowExecutionGraph.isTaskExecutionRunnableActive(taskExecutionRunnable)
+        ) {
+            super.killedEventAction(workflowExecutionRunnable, 
taskExecutionRunnable,
+                    TaskKilledLifecycleEvent.of(taskExecutionRunnable));
+            return;
+        }

Review Comment:
   Ok, I got you.
   Please use 
   ```java
   if (taskExecutionRunnable.isTaskInstanceCanRetry()
                   && 
workflowExecutionGraph.isTaskExecutionRunnableActive(taskExecutionRunnable)) {
   ```
    to replace 
   ```java
   if (taskExecutionRunnable.isTaskInstanceCanRetry()
           // && 
workflowExecutionGraph.isTaskExecutionRunnableActive(taskExecutionRunnable)
           ) 
   ```
   
   You can add a new private method for this, this logic also exist in 
`killedEventAction`
   ```java
   private boolean isTaskRetrying(
               final IWorkflowExecutionRunnable workflowExecutionRunnable,
               final ITaskExecutionRunnable taskExecutionRunnable) {
           final IWorkflowExecutionGraph workflowExecutionGraph = 
taskExecutionRunnable.getWorkflowExecutionGraph();
           return taskExecutionRunnable.isTaskInstanceCanRetry()
                   && 
workflowExecutionGraph.isTaskExecutionRunnableActive(taskExecutionRunnable);
       }
   ```



-- 
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