|
27 | 27 | import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; |
28 | 28 | import org.apache.dolphinscheduler.plugin.task.api.model.Property; |
29 | 29 | 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; |
32 | 30 | import org.apache.dolphinscheduler.plugin.task.api.utils.ParameterUtils; |
33 | 31 |
|
34 | 32 | import org.apache.commons.lang3.StringUtils; |
@@ -339,24 +337,22 @@ public void cancelApplication() throws TaskException { |
339 | 337 |
|
340 | 338 | private Map<String, String> generateVariables() { |
341 | 339 | 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()); |
347 | 344 | } |
348 | | - } |
| 345 | + }); |
349 | 346 | 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 | + } |
359 | 354 | } |
| 355 | + log.info("sending variables to dinky: {}", variables); |
360 | 356 | return variables; |
361 | 357 | } |
362 | 358 |
|
|
0 commit comments