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 8f14e8518a48..fa285fcc627a 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,7 +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.ParameterUtils; import org.apache.commons.lang3.StringUtils; @@ -338,23 +337,23 @@ public void cancelApplication() throws TaskException { private Map generateVariables() { Map variables = new ConcurrentHashMap<>(); - List propertyList = JSONUtils.toList(taskExecutionContext.getGlobalParams(), Property.class); - 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) { + // replace localParams value where value is expression + 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; } @@ -466,7 +465,7 @@ private String sendJsonStr(String url, String params) { } catch (Exception he) { log.error("dinky task terminated: ", he); } - return result; + return result;// todo } }