Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -47,7 +46,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -337,24 +335,17 @@ public void cancelApplication() throws TaskException {
}

private Map<String, String> generateVariables() {
Map<String, String> variables = new ConcurrentHashMap<>();
List<Property> propertyList = JSONUtils.toList(taskExecutionContext.getGlobalParams(), Property.class);
if (propertyList != null && !propertyList.isEmpty()) {
for (Property property : propertyList) {
variables.put(property.getProp(), property.getValue());
}
}
List<Property> localParams = this.dinkyParameters.getLocalParams();
Map<String, Property> prepareParamsMap = taskExecutionContext.getPrepareParamsMap();
if (localParams == null || localParams.isEmpty()) {
return variables;
}
Map<String, String> convertMap = ParameterUtils.convert(prepareParamsMap);
for (Property property : localParams) {
String propertyValue = property.getValue();
String value = PlaceholderUtils.replacePlaceholders(propertyValue, convertMap, true);
variables.put(property.getProp(), value);
Map<String, String> variables = ParameterUtils.convert(prepareParamsMap);
List<Property> localParams = this.dinkyParameters.getLocalParams();
if (!localParams.isEmpty()) {
// replace localParams value where value is expression
for (Property property : localParams) {
variables.put(property.getProp(),
ParameterUtils.convertParameterPlaceholders(property.getValue(), variables));
}
}
log.info("sending variables to dinky: {}", variables);
return variables;
}

Expand Down