Skip to content

Commit 860a1c5

Browse files
authored
[Fix-17943][dolphinscheduler-task-dinky] When DolphinScheduler calls a Dinky job and passes date parameters, the actual values are not being replaced (#18080)
1 parent e6a2844 commit 860a1c5

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

  • dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky

dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
2828
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
2929
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
30-
import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
31-
import org.apache.dolphinscheduler.plugin.task.api.utils.GlobalParameterUtils;
3230
import org.apache.dolphinscheduler.plugin.task.api.utils.ParameterUtils;
3331

3432
import org.apache.commons.lang3.StringUtils;
@@ -339,24 +337,22 @@ public void cancelApplication() throws TaskException {
339337

340338
private Map<String, String> generateVariables() {
341339
Map<String, String> variables = new ConcurrentHashMap<>();
342-
List<Property> propertyList =
343-
GlobalParameterUtils.deserializeGlobalParameter(taskExecutionContext.getGlobalParams());
344-
if (propertyList != null && !propertyList.isEmpty()) {
345-
for (Property property : propertyList) {
346-
variables.put(property.getProp(), property.getValue());
340+
Map<String, Property> prepareParamsMap = taskExecutionContext.getPrepareParamsMap();
341+
prepareParamsMap.forEach((key, property) -> {
342+
if (property != null && property.getValue() != null) {
343+
variables.put(key, property.getValue().trim());
347344
}
348-
}
345+
});
349346
List<Property> localParams = this.dinkyParameters.getLocalParams();
350-
Map<String, Property> prepareParamsMap = taskExecutionContext.getPrepareParamsMap();
351-
if (localParams == null || localParams.isEmpty()) {
352-
return variables;
353-
}
354-
Map<String, String> convertMap = ParameterUtils.convert(prepareParamsMap);
355-
for (Property property : localParams) {
356-
String propertyValue = property.getValue();
357-
String value = PlaceholderUtils.replacePlaceholders(propertyValue, convertMap, true);
358-
variables.put(property.getProp(), value);
347+
if (localParams != null) {
348+
for (Property property : localParams) {
349+
String value = ParameterUtils.convertParameterPlaceholders(property.getValue(), variables);
350+
if (value != null && !value.isEmpty()) {
351+
variables.put(property.getProp(), value.trim());
352+
}
353+
}
359354
}
355+
log.info("sending variables to dinky: {}", variables);
360356
return variables;
361357
}
362358

0 commit comments

Comments
 (0)