geosmart opened a new issue #4050:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4050


   **Describe the feature**
   SparkTask [others] param string current not support variable inject,
   just like [mainArgs],we need to replace ${variable} in [others]
   
   ** just change like this
   org.apache.dolphinscheduler.server.worker.task.spark.SparkTask.java
   ```java
           if (StringUtils.isNotEmpty(sparkParameters.getMainArgs())) {
               String args = sparkParameters.getMainArgs();
   
               // replace placeholder
               Map<String, Property> paramsMap = 
ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()),
                       taskExecutionContext.getDefinedParams(),
                       sparkParameters.getLocalParametersMap(),
                       
CommandType.of(taskExecutionContext.getCmdTypeIfComplement()),
                       taskExecutionContext.getScheduleTime());
   
               if (paramsMap != null) {
                   args = ParameterUtils.convertParameterPlaceholders(args, 
ParamUtils.convert(paramsMap));
               }
               sparkParameters.setMainArgs(args);
           }
   ```
   change it to
   
   ```java
           if (StringUtils.isNotEmpty(sparkParameters.getMainArgs())) {
               String args = sparkParameters.getMainArgs();
               String others = sparkParameters.getOthers();
   
               // replace placeholder
               Map<String, Property> paramsMap = 
ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()),
                       taskExecutionContext.getDefinedParams(),
                       sparkParameters.getLocalParametersMap(),
                       
CommandType.of(taskExecutionContext.getCmdTypeIfComplement()),
                       taskExecutionContext.getScheduleTime());
   
               if (paramsMap != null) {
                   Map<String, String> formatParamsMap = 
ParamUtils.convert(paramsMap);
                   args = ParameterUtils.convertParameterPlaceholders(args, 
formatParamsMap);
                   others = ParameterUtils.convertParameterPlaceholders(others, 
formatParamsMap);
               }
               sparkParameters.setMainArgs(args);
               sparkParameters.setOthers(others);
           }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to