wangxj3 commented on a change in pull request #5603:
URL: https://github.com/apache/dolphinscheduler/pull/5603#discussion_r655047636



##########
File path: 
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java
##########
@@ -518,42 +518,61 @@ private TaskInstance createTaskInstance(ProcessInstance 
processInstance, TaskNod
             } else {
                 taskInstance.setWorkerGroup(taskWorkerGroup);
             }
-            
taskInstance.setTaskParams(globalParamToTaskParams(taskNode.getTaskParams()));
             // delay execution time
             taskInstance.setDelayTime(taskNode.getDelayTime());
         }
+
+        //get pre task ,get all the task varPool to this task
+        Set<String> preTask =  dag.getPreviousNodes(taskInstance.getName());
+        getPreVarPool(taskInstance, preTask);
         return taskInstance;
     }
 
-    private String globalParamToTaskParams(String params) {
-        String globalParams = this.processInstance.getGlobalParams();
-        if (StringUtils.isBlank(globalParams)) {
-            return params;
-        }
-        Map<String, String> globalMap = 
processService.getGlobalParamMap(globalParams);
-        if (globalMap == null || globalMap.size() == 0) {
-            return params;
-        }
-        // the process global param save in localParams
-        Map<String, Object> result = JSONUtils.toMap(params, String.class, 
Object.class);
-        Object localParams = result.get(LOCAL_PARAMS);
-        if (localParams != null) {
-            List<Property> allParam = 
JSONUtils.toList(JSONUtils.toJsonString(localParams), Property.class);
-            for (Property info : allParam) {
-                String paramName = info.getProp();
-                if (StringUtils.isNotEmpty(paramName) && 
propToValue.containsKey(paramName)) {
-                    info.setValue((String) propToValue.get(paramName));
-                }
-                if (info.getDirect().equals(Direct.IN)) {
-                    String value = globalMap.get(paramName);
-                    if (StringUtils.isNotEmpty(value)) {
-                        info.setValue(value);
+    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 preTaskName : preTask) {

Review comment:
       > 
   > 
   > In order to avoid time complexity O (n ^ 2), can this method be optimized
   
   I will do this in a new pr.




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