|
|
@ -684,37 +684,38 @@ public class MasterExecThread implements Runnable { |
|
|
|
* determine whether the dependencies of the task node are complete |
|
|
|
* determine whether the dependencies of the task node are complete |
|
|
|
* @return DependResult |
|
|
|
* @return DependResult |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@SuppressWarnings("checkstyle:WhitespaceAround") |
|
|
|
private DependResult isTaskDepsComplete(String taskName) { |
|
|
|
private DependResult isTaskDepsComplete(String taskName) { |
|
|
|
|
|
|
|
|
|
|
|
Collection<String> startNodes = dag.getBeginNode(); |
|
|
|
Collection<String> startNodes = dag.getBeginNode(); |
|
|
|
// if vertex,returns true directly
|
|
|
|
// if vertex,returns true directly
|
|
|
|
if(startNodes.contains(taskName)){ |
|
|
|
if (startNodes.contains(taskName)) { |
|
|
|
return DependResult.SUCCESS; |
|
|
|
return DependResult.SUCCESS; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
if(!dag.containsNode(depsNode) |
|
|
|
if (!dag.containsNode(depsNode) |
|
|
|
|| 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)) { |
|
|
|
return DependResult.WAITING; |
|
|
|
return DependResult.WAITING; |
|
|
|
} |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ignore task state if current task is condition
|
|
|
|
// ignore task state if current task is condition
|
|
|
|
if(taskNode.isConditionsTask()){ |
|
|
|
if (taskNode.isConditionsTask()) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
if(!dependTaskSuccess(depsNode, taskName)){ |
|
|
|
if (!dependTaskSuccess(depsNode, taskName)) { |
|
|
|
return DependResult.FAILED; |
|
|
|
return DependResult.FAILED; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -730,18 +731,18 @@ public class MasterExecThread implements Runnable { |
|
|
|
* @param nextNodeName |
|
|
|
* @param nextNodeName |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
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(tmpNode.isConditionsTask()){ |
|
|
|
if (tmpNode.isConditionsTask()) { |
|
|
|
//condition task need check the branch to run
|
|
|
|
//condition task need check the branch to run
|
|
|
|
List<String> nextTaskList = parseConditionTask(dependNodeName); |
|
|
|
List<String> nextTaskList = parseConditionTask(dependNodeName); |
|
|
|
if(!nextTaskList.contains(nextNodeName)){ |
|
|
|
if (!nextTaskList.contains(nextNodeName)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
ExecutionStatus depTaskState = completeTaskList.get(dependNodeName).getState(); |
|
|
|
ExecutionStatus depTaskState = completeTaskList.get(dependNodeName).getState(); |
|
|
|
if(depTaskState.typeIsFailure()){ |
|
|
|
if (depTaskState.typeIsFailure()) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1062,17 +1063,17 @@ public class MasterExecThread implements Runnable { |
|
|
|
// failure priority is higher than pause
|
|
|
|
// failure priority is higher than pause
|
|
|
|
// if a task fails, other suspended tasks need to be reset kill
|
|
|
|
// if a task fails, other suspended tasks need to be reset kill
|
|
|
|
// check if there exists forced success nodes in errorTaskList
|
|
|
|
// check if there exists forced success nodes in errorTaskList
|
|
|
|
if(errorTaskList.size() > 0){ |
|
|
|
if (errorTaskList.size() > 0) { |
|
|
|
for(Map.Entry<String, TaskInstance> entry: completeTaskList.entrySet()) { |
|
|
|
for (Map.Entry<String, TaskInstance> entry : completeTaskList.entrySet()) { |
|
|
|
TaskInstance completeTask = entry.getValue(); |
|
|
|
TaskInstance completeTask = entry.getValue(); |
|
|
|
if(completeTask.getState()== ExecutionStatus.PAUSE){ |
|
|
|
if (completeTask.getState() == ExecutionStatus.PAUSE) { |
|
|
|
completeTask.setState(ExecutionStatus.KILL); |
|
|
|
completeTask.setState(ExecutionStatus.KILL); |
|
|
|
completeTaskList.put(entry.getKey(), completeTask); |
|
|
|
completeTaskList.put(entry.getKey(), completeTask); |
|
|
|
processService.updateTaskInstance(completeTask); |
|
|
|
processService.updateTaskInstance(completeTask); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for(Map.Entry<String, TaskInstance> entry: errorTaskList.entrySet()) { |
|
|
|
for (Map.Entry<String, TaskInstance> entry : errorTaskList.entrySet()) { |
|
|
|
TaskInstance errorTask = entry.getValue(); |
|
|
|
TaskInstance errorTask = entry.getValue(); |
|
|
|
TaskInstance currentTask = processService.findTaskInstanceById(errorTask.getId()); |
|
|
|
TaskInstance currentTask = processService.findTaskInstanceById(errorTask.getId()); |
|
|
|
if (currentTask == null) { |
|
|
|
if (currentTask == null) { |
|
|
@ -1089,7 +1090,7 @@ public class MasterExecThread implements Runnable { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(canSubmitTaskToQueue()){ |
|
|
|
if (canSubmitTaskToQueue()) { |
|
|
|
submitStandByTask(); |
|
|
|
submitStandByTask(); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|