From cdd76d6b118a65f863f3581f0911807f6fa43fc8 Mon Sep 17 00:00:00 2001 From: lenboo Date: Sun, 2 Aug 2020 11:13:50 +0800 Subject: [PATCH] refactor depend result --- .../master/runner/MasterExecThread.java | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) 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 097e8d74d2..479d6560a6 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 @@ -675,7 +675,6 @@ public class MasterExecThread implements Runnable { if(!completeTaskList.containsKey(depsNode)){ return DependResult.WAITING; } - // depend node has already complete. ExecutionStatus depTaskState = completeTaskList.get(depsNode).getState(); if(depTaskState.typeIsPause() || depTaskState.typeIsCancel()){ return DependResult.WAITING; @@ -684,13 +683,7 @@ public class MasterExecThread implements Runnable { if(taskNode.isConditionsTask()){ continue; } - if(dag.getNode(depsNode).isConditionsTask()){ - //condition task need check the branch to run - List nextTaskList = parseConditionTask(depsNode); - if(!nextTaskList.contains(taskName)){ - return DependResult.FAILED; - } - }else if(depTaskState.typeIsFailure()){ + if(!dependTaskSuccess(depsNode, taskName)){ return DependResult.FAILED; } } @@ -698,6 +691,28 @@ public class MasterExecThread implements Runnable { return DependResult.SUCCESS; } + /** + * depend node is completed, but here need check the condition task branch is the next node + * @param dependNodeName + * @param nextNodeName + * @return + */ + private boolean dependTaskSuccess(String dependNodeName, String nextNodeName){ + if(dag.getNode(dependNodeName).isConditionsTask()){ + //condition task need check the branch to run + List nextTaskList = parseConditionTask(dependNodeName); + if(!nextTaskList.contains(nextNodeName)){ + return false; + } + }else { + ExecutionStatus depTaskState = completeTaskList.get(dependNodeName).getState(); + if(depTaskState.typeIsFailure()){ + return false; + } + } + return true; + } + /** * query task instance by complete state