Browse Source

refactor depend result

pull/3/MERGE
lenboo 4 years ago
parent
commit
cdd76d6b11
  1. 31
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java

31
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)){ if(!completeTaskList.containsKey(depsNode)){
return DependResult.WAITING; return DependResult.WAITING;
} }
// depend node has already complete.
ExecutionStatus depTaskState = completeTaskList.get(depsNode).getState(); ExecutionStatus depTaskState = completeTaskList.get(depsNode).getState();
if(depTaskState.typeIsPause() || depTaskState.typeIsCancel()){ if(depTaskState.typeIsPause() || depTaskState.typeIsCancel()){
return DependResult.WAITING; return DependResult.WAITING;
@ -684,13 +683,7 @@ public class MasterExecThread implements Runnable {
if(taskNode.isConditionsTask()){ if(taskNode.isConditionsTask()){
continue; continue;
} }
if(dag.getNode(depsNode).isConditionsTask()){ if(!dependTaskSuccess(depsNode, taskName)){
//condition task need check the branch to run
List<String> nextTaskList = parseConditionTask(depsNode);
if(!nextTaskList.contains(taskName)){
return DependResult.FAILED;
}
}else if(depTaskState.typeIsFailure()){
return DependResult.FAILED; return DependResult.FAILED;
} }
} }
@ -698,6 +691,28 @@ public class MasterExecThread implements Runnable {
return DependResult.SUCCESS; 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<String> 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 * query task instance by complete state

Loading…
Cancel
Save