WangJPLeo commented on code in PR #9718:
URL: https://github.com/apache/dolphinscheduler/pull/9718#discussion_r857117301
##########
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java:
##########
@@ -565,20 +554,40 @@ public static boolean haveConditionsAfterNode(String
parentNodeCode, List<TaskNo
return false;
}
+
/**
* is there have blocking node after the parent node
*/
public static boolean haveBlockingAfterNode(String parentNodeCode,
DAG<String,TaskNode,TaskNodeRelation> dag) {
+ return haveSubAfterNode(parentNodeCode, dag, true,
TaskConstants.TASK_TYPE_BLOCKING);
+ }
+
+ /**
+ * is there have all node after the parent node
+ */
+ public static boolean haveAllNodeAfterNode(String parentNodeCode,
+
DAG<String,TaskNode,TaskNodeRelation> dag) {
+ return haveSubAfterNode(parentNodeCode, dag, false, null);
+ }
+
+ /**
+ * Whether there is a specified type of child node after the parent node
+ */
+ public static boolean haveSubAfterNode(String parentNodeCode,
+
DAG<String,TaskNode,TaskNodeRelation> dag, boolean typeCheck, String checkType)
{
Set<String> subsequentNodes = dag.getSubsequentNodes(parentNodeCode);
if (CollectionUtils.isEmpty(subsequentNodes)) {
return false;
}
for (String nodeName : subsequentNodes) {
TaskNode taskNode = dag.getNode(nodeName);
List<String> preTaskList =
JSONUtils.toList(taskNode.getPreTasks(),String.class);
- if (preTaskList.contains(parentNodeCode) &&
taskNode.isBlockingTask()) {
- return true;
+ boolean contains = preTaskList.contains(parentNodeCode);
+ if (typeCheck){
+ return contains &&
taskNode.getType().equalsIgnoreCase(checkType);
+ } else {
+ return contains;
Review Comment:
ok, i will fix it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]