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

zihaoxiang 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 10295d322a [Improvement-16487][Master] Improve the dependent result 
for workflow dependency tasks (#16488)
10295d322a is described below

commit 10295d322a34868c455f14d892689b7f032818f1
Author: veli.yang <[email protected]>
AuthorDate: Thu Aug 22 16:28:36 2024 +0800

    [Improvement-16487][Master] Improve the dependent result for workflow 
dependency tasks (#16488)
---
 .../server/master/utils/DependentExecute.java           | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git 
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/DependentExecute.java
 
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/DependentExecute.java
index 28f9fd682b..f3f48365df 100644
--- 
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/DependentExecute.java
+++ 
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/DependentExecute.java
@@ -284,7 +284,7 @@ public class DependentExecute {
                 addItemVarPool(taskInstance.getVarPool(), 
taskInstance.getEndTime().getTime());
                 return DependResult.SUCCESS;
             }
-            return getDependResultByState(taskInstance.getState());
+            return getDependResultOfTask(processInstance, taskInstance);
         }
     }
 
@@ -337,18 +337,27 @@ public class DependentExecute {
     }
 
     /**
-     * get dependent result by task/process instance state
+     * get dependent result by task/process instance
      *
-     * @param state state
+     * @param processInstance process instance
+     * @param taskInstance task instance
      * @return DependResult
      */
-    private DependResult getDependResultByState(TaskExecutionStatus state) {
+    private DependResult getDependResultOfTask(ProcessInstance 
processInstance, TaskInstance taskInstance) {
 
+        TaskExecutionStatus state = taskInstance.getState();
         if (!state.isFinished()) {
             return DependResult.WAITING;
         } else if (state.isSuccess()) {
             return DependResult.SUCCESS;
         } else {
+            if (processInstance.getState().isRunning()
+                    && taskInstance.getRetryTimes() < 
taskInstance.getMaxRetryTimes()) {
+                log.info("taskDefinitionCode: {}, taskDefinitionName: {}, 
retryTimes: {}, maxRetryTimes: {}",
+                        taskInstance.getTaskCode(), taskInstance.getName(), 
taskInstance.getRetryTimes(),
+                        taskInstance.getMaxRetryTimes());
+                return DependResult.WAITING;
+            }
             log.warn(
                     "The dependent task were not executed successfully, so 
return depend failed. Task code: {}, task name: {}.",
                     taskInstance.getTaskCode(), taskInstance.getName());

Reply via email to