Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -339,24 +337,22 @@ public void cancelApplication() throws TaskException {

private Map<String, String> generateVariables() {
Map<String, String> variables = new ConcurrentHashMap<>();
List<Property> propertyList =
GlobalParameterUtils.deserializeGlobalParameter(taskExecutionContext.getGlobalParams());
if (propertyList != null && !propertyList.isEmpty()) {
for (Property property : propertyList) {
variables.put(property.getProp(), property.getValue());
Map<String, Property> prepareParamsMap = taskExecutionContext.getPrepareParamsMap();
prepareParamsMap.forEach((key, property) -> {
if (property != null && property.getValue() != null) {
variables.put(key, property.getValue().trim());
}
}
});
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);
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);
Comment on lines +340 to +355
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe directly use taskExecutionContext.getPrepareParamsMap() is enough?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe directly use taskExecutionContext.getPrepareParamsMap() is enough?

No,it is not enough. The time function is not converted.

return variables;
}

Expand Down
Loading