You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dolphinscheduler.apache.org by boyi <zh...@163.com> on 2020/11/03 07:18:26 UTC
[DISCUSS] How to split the process_definition_json field in the
process definition
hi:
This email mainly discusses how to split the field process_definition_json in the process definition [t_ds_process_definition] table.
First, provide a minimum change idea. According to this idea, the basic API and Master service only need to make a few changes, and the UI and Worker remain basically unchanged.
Split t_ds_process_definition into two tables, t_ds_process_definition and t_ds_process_definition_task:
t_ds_process_definition is consistent with the original t_ds_process_definition field, except that the process_definition_json field is deleted.
Split according to the process_definition_json field in the t_ds_process_definition table to generate the t_ds_process_definition_task table.
一. t_ds_process_definition
The t_ds_process_definition table structure is shown in the following table:
| 序号 | 字段 | 类型 | 描述 |
| 1 | id | int(11) | 主键 |
| 2 | name | varchar(255) | 流程定义名称 |
| 3 | version | int(11) | 流程定义版本 |
| 4 | release_state | tinyint(4) | 流程定义的发布状态:0 未上线 , 1已上线 |
| 5 | project_id | int(11) | 项目id |
| 6 | user_id | int(11) | 流程定义所属用户id |
| 7 | description | text | 流程定义描述 |
| 8 | global_params | text | 全局参数 |
| 9 | flag | tinyint(4) | 流程是否可用:0 不可用,1 可用 |
| 10 | locations | text | 节点坐标信息 |
| 11 | connects | text | 节点连线信息 |
| 12 | receivers | text | 收件人 |
| 13 | receivers_cc | text | 抄送人 |
| 14 | create_time | datetime | 创建时间 |
| 15 | timeout | int(11) | 超时时间 |
| 16 | tenant_id | int(11) | 租户id |
| 17 | update_time | datetime | 更新时间 |
| 18 | modify_by | varchar(36) | 修改用户 |
| 19 | resource_ids | varchar(255) | 资源ids |
二. t_ds_process_definition_task
The t_ds_process_definition_task table structure is shown in the following table:
| 序号 | 参数名 | 类型 | 描述 |
| 1 | id | int(11) | 任务id |
| 2 | name | varchar(255) | 任务名称 |
| 3 | type | varchar(64) | 类型 [SHLL,PYTHON,DATAX,SPARK 等等 ] |
| 4 | process_definition_id | int(11) | 流程定义id |
| 5 | params | longtext | 自定义参数 [ Json 格式 保存原有的params字段, 自定义参数和资源文件参数是否拆出 ] |
| 6 | description | text | 描述 |
| 7 | runFlag | tinyint(4) | 运行标识 |
| 8 | conditionResult | longtext | 条件分支 [JSON格式] |
| 9 | dependence | longtext | 任务依赖 [JSON格式] |
| 10 | maxRetryTimes | tinyint(4) | 最大重试次数 |
| 11 | retryInterval | tinyint(4) | 重试间隔 |
| 12 | timeout | varchar(128) | 超时控制策略 [JSON格式] |
| 13 | taskInstancePriority | varchar(16) | 任务优先级 |
| 14 | workerGroup | varchar(64) | Worker 分组名称 |
| 15 | preTasks | varchar(128) | 前置任务 |
Reference materials:
metadata document :
https://github.com/apache/incubator-dolphinscheduler-website/blob/master/docs/zh-cn/1.3.2/user_doc/metadata-1.3.md
task storage structure:
https://github.com/apache/incubator-dolphinscheduler-website/blob/master/docs/zh-cn/1.3.2/user_doc/task-structure.md
-----------------------------------------------------------------------------------------------------------------------------------------
本邮件主要讨论工作流定义[t_ds_process_definition]表中的字段process_definition_json如何拆分.
先提供一种最小改动思路. 按照这种思路,基本API,Master服务只需要做少许变动, UI和Worker基本保持不变.
将t_ds_process_definition拆分成两个表t_ds_process_definition 和 t_ds_process_definition_task两个表 :
t_ds_process_definition跟原有t_ds_process_definition字段保持一致,只是删除了process_definition_json字段.
根据t_ds_process_definition表中的process_definition_json字段进行拆分生成t_ds_process_definition_task表.
一. t_ds_process_definition[主体]
t_ds_process_definition 表结构如下表所示:
| 序号 | 字段 | 类型 | 描述 |
| 1 | id | int(11) | 主键 |
| 2 | name | varchar(255) | 流程定义名称 |
| 3 | version | int(11) | 流程定义版本 |
| 4 | release_state | tinyint(4) | 流程定义的发布状态:0 未上线 , 1已上线 |
| 5 | project_id | int(11) | 项目id |
| 6 | user_id | int(11) | 流程定义所属用户id |
| 7 | description | text | 流程定义描述 |
| 8 | global_params | text | 全局参数 |
| 9 | flag | tinyint(4) | 流程是否可用:0 不可用,1 可用 |
| 10 | locations | text | 节点坐标信息 |
| 11 | connects | text | 节点连线信息 |
| 12 | receivers | text | 收件人 |
| 13 | receivers_cc | text | 抄送人 |
| 14 | create_time | datetime | 创建时间 |
| 15 | timeout | int(11) | 超时时间 |
| 16 | tenant_id | int(11) | 租户id |
| 17 | update_time | datetime | 更新时间 |
| 18 | modify_by | varchar(36) | 修改用户 |
| 19 | resource_ids | varchar(255) | 资源ids |
二. t_ds_process_definition_task [任务]
根据t_ds_process_definition表中的process_definition_json字段进行拆分.
字段如下:
| 序号 | 参数名 | 类型 | 描述 |
| 1 | id | int(11) | 任务id |
| 2 | name | varchar(255) | 任务名称 |
| 3 | type | varchar(64) | 类型 [SHLL,PYTHON,DATAX,SPARK 等等 ] |
| 4 | process_definition_id | int(11) | 流程定义id |
| 5 | params | longtext | 自定义参数 [ Json 格式 保存原有的params字段, 自定义参数和资源文件参数是否拆出 ] |
| 6 | description | text | 描述 |
| 7 | runFlag | tinyint(4) | 运行标识 |
| 8 | conditionResult | longtext | 条件分支 [JSON格式] |
| 9 | dependence | longtext | 任务依赖 [JSON格式] |
| 10 | maxRetryTimes | tinyint(4) | 最大重试次数 |
| 11 | retryInterval | tinyint(4) | 重试间隔 |
| 12 | timeout | varchar(128) | 超时控制策略 [JSON格式] |
| 13 | taskInstancePriority | varchar(16) | 任务优先级 |
| 14 | workerGroup | varchar(64) | Worker 分组名称 |
| 15 | preTasks | varchar(128) | 前置任务 |
参考资料 :
Dolphin Scheduler 1.3元数据文档
https://github.com/apache/incubator-dolphinscheduler-website/blob/master/docs/zh-cn/1.3.2/user_doc/metadata-1.3.md
工作流任务存储结构 :
https://github.com/apache/incubator-dolphinscheduler-website/blob/master/docs/zh-cn/1.3.2/user_doc/task-structure.md
--------------------------------------
BoYi ZhangE-mail : zhangboyi_mx@163.com