From a0955a078a2ca83f3736caf5f05a325545168114 Mon Sep 17 00:00:00 2001 From: Hua Jiang Date: Tue, 30 Nov 2021 09:59:48 +0800 Subject: [PATCH] [Fix-7019][MasterServer] Fix the issue with failing to save and run the process that contains the switch task. (#7046) --- .../common/task/switchtask/SwitchResultVo.java | 4 ++++ .../java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | 2 +- .../server/master/runner/task/SwitchTaskProcessor.java | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/switchtask/SwitchResultVo.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/switchtask/SwitchResultVo.java index 558a6f1b83..07f0f94a54 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/switchtask/SwitchResultVo.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/switchtask/SwitchResultVo.java @@ -42,6 +42,10 @@ public class SwitchResultVo { List nextNodeList = new ArrayList<>(); nextNodeList.add(String.valueOf(nextNode)); this.nextNode = nextNodeList; + } else if (nextNode instanceof Number) { + List nextNodeList = new ArrayList<>(); + nextNodeList.add(nextNode.toString()); + this.nextNode = nextNodeList; } else { this.nextNode = (ArrayList) nextNode; } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java index 3501291847..d419505e83 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java @@ -406,7 +406,7 @@ public class DagHelper { Map completeTaskList, DAG dag) { - SwitchParameters switchParameters = completeTaskList.get(taskNode.getName()).getSwitchDependency(); + SwitchParameters switchParameters = completeTaskList.get(Long.toString(taskNode.getCode())).getSwitchDependency(); int resultConditionLocation = switchParameters.getResultConditionLocation(); List conditionResultVoList = switchParameters.getDependTaskList(); List switchTaskList = conditionResultVoList.get(resultConditionLocation).getNextNode(); diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/SwitchTaskProcessor.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/SwitchTaskProcessor.java index 70013e176d..3b95c43190 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/SwitchTaskProcessor.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/SwitchTaskProcessor.java @@ -210,7 +210,7 @@ public class SwitchTaskProcessor extends BaseTaskProcessor { if (!org.apache.commons.lang.math.NumberUtils.isNumber(value)) { value = "\"" + value + "\""; } - logger.info("paramName:{},paramValue{}", paramName, value); + logger.info("paramName:{},paramValue:{}", paramName, value); content = content.replace("${" + paramName + "}", value); } return content;