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 2021/01/07 08:42:16 UTC

[GitHub] [incubator-dolphinscheduler] wangxj3 commented on issue #3805: [Feature][DICUSSION] The implement of passing variables between tasks

wangxj3 commented on issue #3805:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/3805#issuecomment-755972434


   关于全局变量(节点间参数传递)实现方案的讨论:
   目前我们已经实现了全局变量功能,具体为:
   1.变量在流程实例内生效,每个节点可接受变量,sql和shell节点可修改变量值,后续节点在使用该变量时为修改后的值。
   2.子流程节点传入变量,子流程可以接受到变量值
   3.流程实例在某节点失败后,从失败节点重启,以前执行成功的节点对变量的修改依然生效。
   实现方案为:
   1.用户在保存工作流时,会在点击保存按钮后的弹出框内添加全局变量定义(全局定义),将定义的变量名和初始值(如果有初始值的话)保存到t_ds_process_definition.global_params字段(沿用已有功能),保存时会校验节点所使用的的变量名全部来自【全局定义】。
   2.在工作流被调起实例化的时候,将变量值初始化到t_ds_process_instance.global_params字段中。
   3.关于入参:在创建taskInstance时,从localParam中取出变量,并将t_ds_process_instance.global_params中最新的值更新至localParam中。存入taskInstance,后续将taskInstance保存数据库,并分发给worker,后续参数处理沿用原有部分。
   4.关于出参:在sql节点和shell节点任务执行结束后,将任务执行的结果写入TaskExecuteResponseCommand,随worker执行结果信息一起返回master,master将出参更新t_ds_process_instance.global_params,并将其更新至数据库。
   5.关于子流程节点:生成子流程的command时判断是否有参数传递,如果有参数传递,会将参数写入到command表中。在工作流实例化时处理该部分数据。
   以下为该方案流程图:
   ![图片](https://user-images.githubusercontent.com/26736756/103870167-4f7a4980-5106-11eb-9d2e-dbf9fbcd0716.png)
   ![图片](https://user-images.githubusercontent.com/26736756/103870190-56a15780-5106-11eb-93c2-cf7f653679e6.png)
   ![图片](https://user-images.githubusercontent.com/26736756/103870358-910af480-5106-11eb-93dc-74c09d055f76.png)
   ![图片](https://user-images.githubusercontent.com/26736756/103870382-98ca9900-5106-11eb-97ed-1beeafe41ac0.png)
   


----------------------------------------------------------------
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:
users@infra.apache.org