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

zhongjiajie pushed a commit to branch 2.0.6-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/2.0.6-prepare by this push:
     new 42ba593ae4 [Fix-10762] [bug] Dependent tasks wait for the workflow to 
end (#10765)
42ba593ae4 is described below

commit 42ba593ae440843a690aee3d127156bef174fb50
Author: JinYong Li <[email protected]>
AuthorDate: Mon Jul 4 15:31:04 2022 +0800

    [Fix-10762] [bug] Dependent tasks wait for the workflow to end (#10765)
    
    * issue 8645 (#8811)
    
    Co-authored-by: 北笙 <“[email protected]”>
    Co-authored-by: zhanqian <[email protected]>
    
    * [fix-8929][DAO]Description Failed to upload the file because the full 
name was too long (#9020)
    
    * [fix-8929][DAO]Description Failed to upload the file because the full 
name was too long
    
    * [DS-#8929][fix]Description Failed to upload the file because the full 
name was too long
    
    * [DS-#8929][fix]Description Failed to upload the file because the full 
name was too long
    
    * [DS-#8929][fix]Description Failed to upload the file because the full 
name was too long
    
    Co-authored-by: houshuai <[email protected]>
    
    * [BUG][ALERT-SERVER]validate script before alert script (#9834)
    
    * validate script before alert script
    
    * fix validate script before alert script
    
    * pick 8811/9020/9834
    
    * fix ut
    
    * fix pick error
    
    * fix 10762
    
    Co-authored-by: zhanqian <[email protected]>
    Co-authored-by: 北笙 <“[email protected]”>
    Co-authored-by: zhanqian <[email protected]>
    Co-authored-by: shuai hou <[email protected]>
    Co-authored-by: houshuai <[email protected]>
    Co-authored-by: Tq <[email protected]>
    Co-authored-by: JinyLeeChina <[email protected]>
---
 .../api/service/impl/ResourcesServiceImpl.java        |  1 +
 .../server/utils/DependentExecute.java                | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
index 3698ea0bf8..c00d454614 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
@@ -64,6 +64,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.UUID;
 import java.util.regex.Matcher;
diff --git 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java
 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java
index 77af8699f5..a26e8c6e29 100644
--- 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java
+++ 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java
@@ -115,16 +115,16 @@ public class DependentExecute {
                         dependentItem.getDefinitionCode(), 
dependentItem.getDepTaskCode());
                 return DependResult.WAITING;
             }
-            if (!processInstance.getState().typeIsFinished()) {
-                logger.info("Wait for the dependent workflow to complete, 
processDefiniteCode:{}, taskCode:{}, processInstanceId:{}, processInstance 
state:{}",
-                        dependentItem.getDefinitionCode(), 
dependentItem.getDepTaskCode(), processInstance.getId(), 
processInstance.getState());
-                return DependResult.WAITING;
-            }
             // need to check workflow for updates, so get all task and check 
the task state
             if (dependentItem.getDepTaskCode() == 
Constants.DEPENDENT_ALL_TASK_CODE) {
+                if (!processInstance.getState().typeIsFinished()) {
+                    logger.info("Wait for the dependent workflow to complete, 
processDefiniteCode:{}, taskCode:{}, processInstanceId:{}, processInstance 
state:{}",
+                        dependentItem.getDefinitionCode(), 
dependentItem.getDepTaskCode(), processInstance.getId(), 
processInstance.getState());
+                    return DependResult.WAITING;
+                }
                 result = dependResultByProcessInstance(processInstance, 
dateInterval);
             } else {
-                result = getDependTaskResult(dependentItem.getDepTaskCode(), 
dateInterval);
+                result = getDependTaskResult(processInstance, 
dependentItem.getDepTaskCode(), dateInterval);
             }
             if (result != DependResult.SUCCESS) {
                 break;
@@ -192,10 +192,15 @@ public class DependentExecute {
     /**
      * get depend task result
      */
-    private DependResult getDependTaskResult(long taskCode, DateInterval 
dateInterval) {
+    private DependResult getDependTaskResult(ProcessInstance processInstance, 
long taskCode, DateInterval dateInterval) {
         TaskInstance taskInstance = 
processService.findLastTaskInstanceInterval(taskCode, dateInterval);
         DependResult result;
         if (taskInstance == null) {
+            if (!processInstance.getState().typeIsFinished()) {
+                logger.info("Wait for the dependent workflow to complete, 
taskCode:{}, processInstanceId:{}, processInstance state:{}",
+                    taskCode, processInstance.getId(), 
processInstance.getState());
+                return DependResult.WAITING;
+            }
             TaskDefinition taskDefinition = 
processService.findTaskDefinitionByCode(taskCode);
             if (taskDefinition == null) {
                 logger.error("Cannot find the task definition, something 
error, taskCode: {}", taskCode);

Reply via email to