From e6dade71bb1a30e2499d51af8da20b245e319608 Mon Sep 17 00:00:00 2001 From: Tq Date: Mon, 25 Apr 2022 14:05:40 +0800 Subject: [PATCH] fix process instance global param not include to task instance when master executing (#9730) --- .../service/process/ProcessServiceImpl.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java index bbf1e2b788..e06d84287f 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java @@ -27,6 +27,8 @@ import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID; import static org.apache.dolphinscheduler.common.Constants.LOCAL_PARAMS; +import static org.apache.dolphinscheduler.plugin.task.api.enums.DataType.VARCHAR; +import static org.apache.dolphinscheduler.plugin.task.api.enums.Direct.IN; import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TASK_INSTANCE_ID; import org.apache.dolphinscheduler.common.Constants; @@ -814,14 +816,22 @@ public class ProcessServiceImpl implements ProcessService { } startParamMap.putAll(fatherParamMap); // set start param into global params + Map globalMap = processDefinition.getGlobalParamMap(); + List globalParamList = processDefinition.getGlobalParamList(); if (startParamMap.size() > 0 - && processDefinition.getGlobalParamMap() != null) { - for (Map.Entry param : processDefinition.getGlobalParamMap().entrySet()) { + && globalMap != null) { + for (Map.Entry param : globalMap.entrySet()) { String val = startParamMap.get(param.getKey()); if (val != null) { param.setValue(val); } } + for (Entry startParam : startParamMap.entrySet()) { + if (!globalMap.containsKey(startParam.getKey())) { + globalMap.put(startParam.getKey(), startParam.getValue()); + globalParamList.add(new Property(startParam.getKey(), IN, VARCHAR, startParam.getValue())); + } + } } }