jieguangzhou opened a new issue, #13140:
URL: https://github.com/apache/dolphinscheduler/issues/13140

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar feature requirement.
   
   
   ### Description
   
   In restarting failed task, dag is incomplete, the failed task can not get 
preTask from dag. But in `getPreVarPool ` method, our implement method is to 
get the `varPool` from `processInstance` because preTask is empty. This will 
lead to some unknown errors. For example, ` varPool` in `processInstance` is 
updated by something else.
   
   I think we can find the actual upstream tasks from the database or other 
places.
   
   ```java
       public void getPreVarPool(TaskInstance taskInstance, Set<String> 
preTask) {
           Map<String, Property> allProperty = new HashMap<>();
           Map<String, TaskInstance> allTaskInstance = new HashMap<>();
           if (CollectionUtils.isNotEmpty(preTask)) {
               for (String preTaskCode : preTask) {
                   Integer taskId = 
completeTaskMap.get(Long.parseLong(preTaskCode));
                   if (taskId == null) {
                       continue;
                   }
                   TaskInstance preTaskInstance = taskInstanceMap.get(taskId);
                   if (preTaskInstance == null) {
                       continue;
                   }
                   String preVarPool = preTaskInstance.getVarPool();
                   if (StringUtils.isNotEmpty(preVarPool)) {
                       List<Property> properties = JSONUtils.toList(preVarPool, 
Property.class);
                       for (Property info : properties) {
                           setVarPoolValue(allProperty, allTaskInstance, 
preTaskInstance, info);
                       }
                   }
               }
               if (allProperty.size() > 0) {
                   
taskInstance.setVarPool(JSONUtils.toJsonString(allProperty.values()));
               }
           } else {
               if (StringUtils.isNotEmpty(processInstance.getVarPool())) {
                   taskInstance.setVarPool(processInstance.getVarPool());
               }
           }
       }
   ```
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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

To unsubscribe, e-mail: 
[email protected]

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

Reply via email to