You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/03/15 02:34:19 UTC

[GitHub] [dolphinscheduler] caishunfeng commented on a change in pull request #8522: [Feature-#8318] [master-server] Sub process transfer parameters to father process

caishunfeng commented on a change in pull request #8522:
URL: https://github.com/apache/dolphinscheduler/pull/8522#discussion_r826529144



##########
File path: dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/SubTaskProcessor.java
##########
@@ -110,9 +119,35 @@ private void updateTaskState() {
         if (subProcessInstance != null && subProcessInstance.getState().typeIsFinished()) {
             taskInstance.setState(subProcessInstance.getState());
             taskInstance.setEndTime(new Date());
+            dealFinish();
             processService.saveTaskInstance(taskInstance);
         }
     }
+    private void dealFinish() {
+        String thisTaskInstanceVarPool = taskInstance.getVarPool();
+        if (StringUtils.isNotEmpty(thisTaskInstanceVarPool)) {
+            String subProcessInstanceVarPool = subProcessInstance.getVarPool();
+            if (StringUtils.isNotEmpty(subProcessInstanceVarPool)) {
+                List<Property> varPoolProperties = JSONUtils.toList(thisTaskInstanceVarPool, Property.class);
+                Map<String, Object> taskParams = JSONUtils.parseObject(taskInstance.getTaskParams(), new TypeReference<Map<String, Object>>() {
+                });
+                Object localParams = taskParams.get(LOCAL_PARAMS);

Review comment:
       Should global parameters be handled as well?

##########
File path: dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
##########
@@ -471,6 +472,9 @@ private void taskFinished(TaskInstance taskInstance) {
             completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
         }
 
+        if(taskInstance.isSubProcess()) {

Review comment:
       Is there some logic lack?

##########
File path: dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/SubTaskProcessor.java
##########
@@ -110,9 +119,35 @@ private void updateTaskState() {
         if (subProcessInstance != null && subProcessInstance.getState().typeIsFinished()) {
             taskInstance.setState(subProcessInstance.getState());
             taskInstance.setEndTime(new Date());
+            dealFinish();
             processService.saveTaskInstance(taskInstance);
         }
     }
+    private void dealFinish() {

Review comment:
       I think it's better to add some doc for `dealFinish`, what do you think?

##########
File path: dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
##########
@@ -1279,6 +1283,24 @@ private void submitPostNode(String parentNodeCode) {
             TaskInstance task = createTaskInstance(processInstance, taskNodeObject);
             taskInstances.add(task);
         }
+        //the end node of the branch of the dag
+        if (StringUtils.isNotEmpty(parentNodeCode)&&dag.getEndNode().contains(parentNodeCode)){

Review comment:
       please format the code




-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org