|
|
@ -130,11 +130,6 @@ public class MasterExecThread implements Runnable { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private DAG<String,TaskNode,TaskNodeRelation> dag; |
|
|
|
private DAG<String,TaskNode,TaskNodeRelation> dag; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* all task nodes generated by process instance json |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<TaskNode> allNodes; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* process service |
|
|
|
* process service |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -369,8 +364,6 @@ public class MasterExecThread implements Runnable { |
|
|
|
} |
|
|
|
} |
|
|
|
// generate process dag
|
|
|
|
// generate process dag
|
|
|
|
dag = DagHelper.buildDagGraph(processDag); |
|
|
|
dag = DagHelper.buildDagGraph(processDag); |
|
|
|
|
|
|
|
|
|
|
|
allNodes = DagHelper.getAllTaskNodesFromFlowJson(processInstance.getProcessInstanceJson()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -540,7 +533,7 @@ public class MasterExecThread implements Runnable { |
|
|
|
private void setTaskNodeSkip(List<String> taskNodesSkipList){ |
|
|
|
private void setTaskNodeSkip(List<String> taskNodesSkipList){ |
|
|
|
for(String skipNode : taskNodesSkipList){ |
|
|
|
for(String skipNode : taskNodesSkipList){ |
|
|
|
skipTaskNodeList.putIfAbsent(skipNode, dag.getNode(skipNode)); |
|
|
|
skipTaskNodeList.putIfAbsent(skipNode, dag.getNode(skipNode)); |
|
|
|
Collection<String> postNodeList = DagHelper.getStartVertex(skipNode, dag, completeTaskList, allNodes); |
|
|
|
Collection<String> postNodeList = DagHelper.getStartVertex(skipNode, dag, completeTaskList); |
|
|
|
List<String> postSkipList = new ArrayList<>(); |
|
|
|
List<String> postSkipList = new ArrayList<>(); |
|
|
|
for(String post : postNodeList){ |
|
|
|
for(String post : postNodeList){ |
|
|
|
TaskNode postNode = dag.getNode(post); |
|
|
|
TaskNode postNode = dag.getNode(post); |
|
|
@ -562,10 +555,6 @@ public class MasterExecThread implements Runnable { |
|
|
|
private List<String> parseConditionTask(String nodeName){ |
|
|
|
private List<String> parseConditionTask(String nodeName){ |
|
|
|
List<String> conditionTaskList = new ArrayList<>(); |
|
|
|
List<String> conditionTaskList = new ArrayList<>(); |
|
|
|
TaskNode taskNode = dag.getNode(nodeName); |
|
|
|
TaskNode taskNode = dag.getNode(nodeName); |
|
|
|
if (taskNode == null) { |
|
|
|
|
|
|
|
taskNode = DagHelper.findNodeByName(allNodes, nodeName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!taskNode.isConditionsTask()){ |
|
|
|
if(!taskNode.isConditionsTask()){ |
|
|
|
return conditionTaskList; |
|
|
|
return conditionTaskList; |
|
|
|
} |
|
|
|
} |
|
|
@ -604,7 +593,7 @@ public class MasterExecThread implements Runnable { |
|
|
|
if(taskNode != null && taskNode.isConditionsTask()){ |
|
|
|
if(taskNode != null && taskNode.isConditionsTask()){ |
|
|
|
return parseConditionTask(previousNodeName); |
|
|
|
return parseConditionTask(previousNodeName); |
|
|
|
} |
|
|
|
} |
|
|
|
Collection<String> postNodeCollection = DagHelper.getStartVertex(previousNodeName, dag, completeTaskList, allNodes); |
|
|
|
Collection<String> postNodeCollection = DagHelper.getStartVertex(previousNodeName, dag, completeTaskList); |
|
|
|
List<String> postSkipList = new ArrayList<>(); |
|
|
|
List<String> postSkipList = new ArrayList<>(); |
|
|
|
// delete success node, parse the past nodes
|
|
|
|
// delete success node, parse the past nodes
|
|
|
|
// if conditions node,
|
|
|
|
// if conditions node,
|
|
|
@ -683,18 +672,13 @@ public class MasterExecThread implements Runnable { |
|
|
|
TaskNode taskNode = dag.getNode(taskName); |
|
|
|
TaskNode taskNode = dag.getNode(taskName); |
|
|
|
List<String> depNameList = taskNode.getDepList(); |
|
|
|
List<String> depNameList = taskNode.getDepList(); |
|
|
|
for(String depsNode : depNameList ){ |
|
|
|
for(String depsNode : depNameList ){ |
|
|
|
// in this condition, it needs to check the command type
|
|
|
|
if(!dag.containsNode(depsNode) |
|
|
|
if((!dag.containsNode(depsNode) && !processInstance.getCommandType().equals(CommandType.RESUME_FROM_FORCED_SUCCESS)) |
|
|
|
|
|
|
|
|| forbiddenTaskList.containsKey(depsNode) |
|
|
|
|| forbiddenTaskList.containsKey(depsNode) |
|
|
|
|| skipTaskNodeList.containsKey(depsNode)){ |
|
|
|
|| skipTaskNodeList.containsKey(depsNode)){ |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
// all the dependencies must be fully completed
|
|
|
|
// all the dependencies must be fully completed
|
|
|
|
if(!completeTaskList.containsKey(depsNode)){ |
|
|
|
if(!completeTaskList.containsKey(depsNode)){ |
|
|
|
// if dag doesn't contain it either, the depend will never be executed, so return failed
|
|
|
|
|
|
|
|
if (!dag.containsNode(depsNode)) { |
|
|
|
|
|
|
|
return DependResult.FAILED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return DependResult.WAITING; |
|
|
|
return DependResult.WAITING; |
|
|
|
} |
|
|
|
} |
|
|
|
ExecutionStatus depTaskState = completeTaskList.get(depsNode).getState(); |
|
|
|
ExecutionStatus depTaskState = completeTaskList.get(depsNode).getState(); |
|
|
@ -725,10 +709,6 @@ public class MasterExecThread implements Runnable { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean dependTaskSuccess(String dependNodeName, String nextNodeName){ |
|
|
|
private boolean dependTaskSuccess(String dependNodeName, String nextNodeName){ |
|
|
|
TaskNode tmpNode = dag.getNode(dependNodeName); |
|
|
|
TaskNode tmpNode = dag.getNode(dependNodeName); |
|
|
|
// if dag doesn't contain depend node
|
|
|
|
|
|
|
|
if (tmpNode == null) { |
|
|
|
|
|
|
|
tmpNode = DagHelper.findNodeByName(allNodes, dependNodeName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(tmpNode.isConditionsTask()){ |
|
|
|
if(tmpNode.isConditionsTask()){ |
|
|
|
//condition task need check the branch to run
|
|
|
|
//condition task need check the branch to run
|
|
|
|