diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java index 70bc8fbffb69..ca531261472b 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java @@ -27,8 +27,6 @@ import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.model.Property; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; -import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils; -import org.apache.dolphinscheduler.plugin.task.api.utils.GlobalParameterUtils; import org.apache.dolphinscheduler.plugin.task.api.utils.ParameterUtils; import org.apache.commons.lang3.StringUtils; @@ -339,24 +337,22 @@ public void cancelApplication() throws TaskException { private Map generateVariables() { Map variables = new ConcurrentHashMap<>(); - List propertyList = - GlobalParameterUtils.deserializeGlobalParameter(taskExecutionContext.getGlobalParams()); - if (propertyList != null && !propertyList.isEmpty()) { - for (Property property : propertyList) { - variables.put(property.getProp(), property.getValue()); + Map prepareParamsMap = taskExecutionContext.getPrepareParamsMap(); + prepareParamsMap.forEach((key, property) -> { + if (property != null && property.getValue() != null) { + variables.put(key, property.getValue().trim()); } - } + }); List localParams = this.dinkyParameters.getLocalParams(); - Map prepareParamsMap = taskExecutionContext.getPrepareParamsMap(); - if (localParams == null || localParams.isEmpty()) { - return variables; - } - Map convertMap = ParameterUtils.convert(prepareParamsMap); - for (Property property : localParams) { - String propertyValue = property.getValue(); - String value = PlaceholderUtils.replacePlaceholders(propertyValue, convertMap, true); - variables.put(property.getProp(), value); + if (localParams != null) { + for (Property property : localParams) { + String value = ParameterUtils.convertParameterPlaceholders(property.getValue(), variables); + if (value != null && !value.isEmpty()) { + variables.put(property.getProp(), value.trim()); + } + } } + log.info("sending variables to dinky: {}", variables); return variables; }