wa-ooo opened a new issue #3177:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/3177


   查看代码可以知道在内部做了两次的参数解析,第一次的解析会把时间表达式处理成运行的当前时间,因为paramsMap中并没有schedule.time
   
   look at the code shows that parameter parsing is done internally twice, the 
first parsing takes the time expression into the current running time because 
there is no schedule.time in paramsMap
   ```
   /**
        *  combining local and global parameters
        */
       Map<String, Property> paramsMap = 
ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()),
               taskExecutionContext.getDefinedParams(),
               shellParameters.getLocalParametersMap(),
               CommandType.of(taskExecutionContext.getCmdTypeIfComplement()),
               taskExecutionContext.getScheduleTime());
       if (paramsMap != null){
         
//paramsMap可能为空,并且ParameterUtils.convertParameterPlaceholders方法使用了system.datetime解析[yyyyMM],第二次的schedule.time总是用不到
         script = ParameterUtils.convertParameterPlaceholders(script, 
ParamUtils.convert(paramsMap));
       }
       // new
       // replace variable TIME with $[YYYYmmddd...] in shell file when history 
run job and batch complement job
       if (paramsMap != null) {
         if (taskExecutionContext.getScheduleTime() != null) {
           String dateTime = 
DateUtils.format(taskExecutionContext.getScheduleTime(), 
Constants.PARAMETER_FORMAT_TIME);
           Property p = new Property();
           p.setValue(dateTime);
           p.setProp(Constants.PARAMETER_SHECDULE_TIME);
           paramsMap.put(Constants.PARAMETER_SHECDULE_TIME, p);
         }
         script = ParameterUtils.convertParameterPlaceholders2(script, 
ParamUtils.convert(paramsMap));
       }
   ```
   
   **Which version of Dolphin Scheduler:**
    -[1.3.1-release]
   


----------------------------------------------------------------
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