1 项目(Project)、工作流(Process)、任务(Task)相关元数据
海豚调度元数据的源代码位置:Github
1.1 项目
1.1.1 项目表:t_ds_project
字段名 | 字段类型 | 字段含义 |
---|---|---|
id | int(11) | 自增主键(页面位置:Project > Project List > #) |
name | varchar(255) | 项目名称(页面位置:Project > Project List > Project Name) |
code | bigint(20) | 项目 ID(项目页面 url 的末尾部分) |
description | varchar(255) | 项目描述(页面位置:Project > Project List > Description) |
user_id | int(11) | 所属用户(页面位置:Project > Project List > Owned Users) |
flag | tinyint(4) | 状态 |
create_time | datetime | 创建时间(页面位置:Project > Project List > Create Time) |
update_time | datetime | 更新时间(页面位置:Project > Project List > Update Time) |
CREATE TABLE `t_ds_project` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
`name` varchar(255) DEFAULT NULL COMMENT 'project name',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`description` varchar(255) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL COMMENT 'creator id',
`flag` tinyint(4) DEFAULT '1' COMMENT '0 not available, 1 available',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime DEFAULT NULL COMMENT 'update time',
PRIMARY KEY (`id`),
KEY `user_id_index` (`user_id`) USING BTREE,
UNIQUE KEY `unique_name`(`name`),
UNIQUE KEY `unique_code`(`code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
唯一键为项目名称(name
)和项目编码(code
)。
1.1.2 项目的用户权限表:t_ds_relation_project_user
字段名 | 字段类型 | 字段含义 |
---|---|---|
id | int(11) | 自增主键 |
user_id | int(11) | 用户 ID |
project_id | int(11) | 项目 ID(对应 t_ds_project 表的 code 字段) |
perm | int(11) | 权限信息 |
create_time | datetime | 创建时间 |
update_time | datetime | 更新时间 |
CREATE TABLE `t_ds_relation_project_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
`user_id` int(11) NOT NULL COMMENT 'user id',
`project_id` int(11) DEFAULT NULL COMMENT 'project id',
`perm` int(11) DEFAULT '1' COMMENT 'limits of authority',
`create_time` datetime DEFAULT NULL COMMENT 'create time',
`update_time` datetime DEFAULT NULL COMMENT 'update time',
PRIMARY KEY (`id`),
UNIQUE KEY uniq_uid_pid(user_id,project_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
1.2 工作流
1.2.1 工作流定义表:t_ds_process_definition
字段名 | 字段类型 | 字段含义 |
---|---|---|
id | int(11) | 自增主键 |
code | int(11) | 工作流定义 ID(工作流页面 url 的末尾部分) |
name | varchar(255) | 工作流定义名称(页面位置:Project > Workflow > Workflow Definition > Workflow Name) |
version | int(11) | 工作流定义版本 |
description | text | 工作流定义描述(页面位置:Project > Workflow > Workflow Definition > Description) |
project_code | bigint(20) | 所属项目 ID |
release_state | tinyint(4) | 工作流定义发布状态 |
user_id | int(11) | 工作流定义创建者(页面位置:Project > Workflow > Workflow Definition > Create User) |
global_params | text | 工作流定义全局参数 |
locations | text | 工作流定义各任务坐标 |
warning_group_id | int(11) | 工作流定义告警组 |
timeout | int(11) | 工作流定义超时时间 |
execution_type | tinyint(4) | 工作流定义执行类型 |
create_time | datetime | 创建时间(页面位置:Project > Workflow > Workflow Definition > Create Time) |
update_time | datetime | 更新时间(页面位置:Project > Workflow > Workflow Definition > Update Time) |
CREATE TABLE `t_ds_process_definition` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`name` varchar(255) DEFAULT NULL COMMENT 'process definition name',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'process definition version',
`description` text COMMENT 'description',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`release_state` tinyint(4) DEFAULT NULL COMMENT 'process definition release state:0:offline,1:online',
`user_id` int(11) DEFAULT NULL COMMENT 'process definition creator id',
`global_params` text COMMENT 'global parameters',
`flag` tinyint(4) DEFAULT NULL COMMENT '0 not available, 1 available',
`locations` text COMMENT 'Node location information',
`warning_group_id` int(11) DEFAULT NULL COMMENT 'alert group id',
`timeout` int(11) DEFAULT '0' COMMENT 'time out, unit: minute',
`execution_type` tinyint(4) DEFAULT '0' COMMENT 'execution_type 0:parallel,1:serial wait,2:serial discard,3:serial priority',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'update time',
PRIMARY KEY (`id`,`code`),
UNIQUE KEY `process_unique` (`name`,`project_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
因为唯一键为 name
和 project_code
,即所属项目 ID 和工作流名称共同构成唯一键,所以在每个项目中,工作流名称是唯一的。
因为在每个任务流中都维护了项目 ID,所以每个任务流是有唯一所属的项目的。
1.2.2 工作流定义历史表:t_ds_process_definition_log
字段含义与工作流定义表相同。
CREATE TABLE `t_ds_process_definition_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`name` varchar(255) DEFAULT NULL COMMENT 'process definition name',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'process definition version',
`description` text COMMENT 'description',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`release_state` tinyint(4) DEFAULT NULL COMMENT 'process definition release state:0:offline,1:online',
`user_id` int(11) DEFAULT NULL COMMENT 'process definition creator id',
`global_params` text COMMENT 'global parameters',
`flag` tinyint(4) DEFAULT NULL COMMENT '0 not available, 1 available',
`locations` text COMMENT 'Node location information',
`warning_group_id` int(11) DEFAULT NULL COMMENT 'alert group id',
`timeout` int(11) DEFAULT '0' COMMENT 'time out,unit: minute',
`execution_type` tinyint(4) DEFAULT '0' COMMENT 'execution_type 0:parallel,1:serial wait,2:serial discard,3:serial priority',
`operator` int(11) DEFAULT NULL COMMENT 'operator user id',
`operate_time` datetime DEFAULT NULL COMMENT 'operate time',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'update time',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_idx_code_version` (`code`,`version`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
1.3 任务
1.3.1 任务定义表(Task)
字段名 | 字段类型 | 字段含义 |
---|---|---|
id | int(11) | 自增主键 |
code | int(11) | 任务定义 ID(工作流页面 url 的末尾部分) |
name | varchar(255) | 任务定义名称(页面位置:Project > Task > Task Definition > Task Name) |
version | int(11) | 任务定义版本(页面位置:Project > Task > Task Definition > Task Version) |
description | text | 任务定义描述 |
project_code | bigint(20) | 所属项目 ID |
user_id | int(11) | 任务定义创建者 |
task_type | varchar(50) | 任务定义的类型 |
task_execute_type | int(11) | 任务定义的执行类型 |
task_params | longtext | 任务定义的参数 |
flag | tinyint(2) | |
is_cache | tinyint(2) | |
worker_group | varchar(255) | 任务定义使用的 Worker 分组 |
environment_code | bigint(20) | 任务定义使用的环境 ID |
fail_retry_times | int(11) | 失败重试次数 |
fail_retry_interval | int(11) | 失败重试间隔 |
timeout_flag | tinyint(2) | 超时告警标记:0 = 关闭,1 = 开启 |
timeout_notify_strategy | tinyint(4) | 超时告警策略 |
delay_time | int(11) | 延时执行时间 |
resourece_ids | text | 任务定义依赖的字段 ID 的列表,用逗号分隔 |
task_group_id | int(11) | 任务组 ID |
task_group_priority | tinyint(4) | 任务组优先级 |
cpu_quota | int(11) | CPU 配额 |
memory_max | int(11) | 最大内存 |
create_time | datetime | 创建时间 |
update_time | datetime | 更新时间 |
CREATE TABLE `t_ds_task_definition` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`name` varchar(255) DEFAULT NULL COMMENT 'task definition name',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'task definition version',
`description` text COMMENT 'description',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`user_id` int(11) DEFAULT NULL COMMENT 'task definition creator id',
`task_type` varchar(50) NOT NULL COMMENT 'task type',
`task_execute_type` int(11) DEFAULT '0' COMMENT 'task execute type: 0-batch, 1-stream',
`task_params` longtext COMMENT 'job custom parameters',
`flag` tinyint(2) DEFAULT NULL COMMENT '0 not available, 1 available',
`is_cache` tinyint(2) DEFAULT '0' COMMENT '0 not available, 1 available',
`task_priority` tinyint(4) DEFAULT '2' COMMENT 'job priority',
`worker_group` varchar(255) DEFAULT NULL COMMENT 'worker grouping',
`environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
`fail_retry_times` int(11) DEFAULT NULL COMMENT 'number of failed retries',
`fail_retry_interval` int(11) DEFAULT NULL COMMENT 'failed retry interval',
`timeout_flag` tinyint(2) DEFAULT '0' COMMENT 'timeout flag:0 close, 1 open',
`timeout_notify_strategy` tinyint(4) DEFAULT NULL COMMENT 'timeout notification policy: 0 warning, 1 fail',
`timeout` int(11) DEFAULT '0' COMMENT 'timeout length,unit: minute',
`delay_time` int(11) DEFAULT '0' COMMENT 'delay execution time,unit: minute',
`resource_ids` text COMMENT 'resource id, separated by comma',
`task_group_id` int(11) DEFAULT NULL COMMENT 'task group id',
`task_group_priority` tinyint(4) DEFAULT '0' COMMENT 'task group priority',
`cpu_quota` int(11) DEFAULT '-1' NOT NULL COMMENT 'cpuQuota(%): -1:Infinity',
`memory_max` int(11) DEFAULT '-1' NOT NULL COMMENT 'MemoryMax(MB): -1:Infinity',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'update time',
PRIMARY KEY (`id`,`code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
在任务表里,只有所属的 project_code
,但没有所属的 process_code
,工作流和任务的依赖关系是通过 t_ds_process_task_relation
表维护的。
在任务表中,如果任务是依赖其他工作流中的任务,则其 task_type
为 DEPENDENT
,其 task_params["dependence"]["dependItemList"]
中会包含它的依赖。
1.3.2 任务定义历史表:t_ds_task_definition_log
字段含义与任务定义表相同。
CREATE TABLE `t_ds_task_definition_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`name` varchar(255) DEFAULT NULL COMMENT 'task definition name',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'task definition version',
`description` text COMMENT 'description',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`user_id` int(11) DEFAULT NULL COMMENT 'task definition creator id',
`task_type` varchar(50) NOT NULL COMMENT 'task type',
`task_execute_type` int(11) DEFAULT '0' COMMENT 'task execute type: 0-batch, 1-stream',
`task_params` longtext COMMENT 'job custom parameters',
`flag` tinyint(2) DEFAULT NULL COMMENT '0 not available, 1 available',
`is_cache` tinyint(2) DEFAULT '0' COMMENT '0 not available, 1 available',
`task_priority` tinyint(4) DEFAULT '2' COMMENT 'job priority',
`worker_group` varchar(255) DEFAULT NULL COMMENT 'worker grouping',
`environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
`fail_retry_times` int(11) DEFAULT NULL COMMENT 'number of failed retries',
`fail_retry_interval` int(11) DEFAULT NULL COMMENT 'failed retry interval',
`timeout_flag` tinyint(2) DEFAULT '0' COMMENT 'timeout flag:0 close, 1 open',
`timeout_notify_strategy` tinyint(4) DEFAULT NULL COMMENT 'timeout notification policy: 0 warning, 1 fail',
`timeout` int(11) DEFAULT '0' COMMENT 'timeout length,unit: minute',
`delay_time` int(11) DEFAULT '0' COMMENT 'delay execution time,unit: minute',
`resource_ids` text DEFAULT NULL COMMENT 'resource id, separated by comma',
`operator` int(11) DEFAULT NULL COMMENT 'operator user id',
`task_group_id` int(11) DEFAULT NULL COMMENT 'task group id',
`task_group_priority` tinyint(4) DEFAULT 0 COMMENT 'task group priority',
`operate_time` datetime DEFAULT NULL COMMENT 'operate time',
`cpu_quota` int(11) DEFAULT '-1' NOT NULL COMMENT 'cpuQuota(%): -1:Infinity',
`memory_max` int(11) DEFAULT '-1' NOT NULL COMMENT 'MemoryMax(MB): -1:Infinity',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'update time',
PRIMARY KEY (`id`),
KEY `idx_code_version` (`code`,`version`),
KEY `idx_project_code` (`project_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
1.4 工作流与任务的关系
1.4.1 工作流与任务的关系表:t_ds_process_task_relation
段名 | 字段类型 | 字段含义 |
---|---|---|
id | int(11) | 自增主键 |
name | varchar(255) | 连接名称 |
project_code | bigint(20) | 所属项目 ID |
process_definition_code | bigint(20) | 所属工作流定义 ID |
process_definition_version | int(11) | 所属工作流定义版本 |
pre_task_code | bigint(20) | 上游任务定义的 ID(如果下游任务定义没有上游任务,则为 0) |
pre_task_version | int(11) | 上游任务定义版本 |
post_task_code | bigint(20) | 下游任务定义的 ID |
post_task_version | int(11) | 下游任务定义版本 |
condition_type | tinyint(2) | 条件类型:0 = none,1 = judge,2 = delay |
condition_params | text | 条件参数 |
create_time | datetime | 创建时间 |
update_time | datetime | 更新时间 |
CREATE TABLE `t_ds_process_task_relation` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`name` varchar(255) DEFAULT NULL COMMENT 'relation name',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`process_definition_code` bigint(20) NOT NULL COMMENT 'process code',
`process_definition_version` int(11) NOT NULL COMMENT 'process version',
`pre_task_code` bigint(20) NOT NULL COMMENT 'pre task code',
`pre_task_version` int(11) NOT NULL COMMENT 'pre task version',
`post_task_code` bigint(20) NOT NULL COMMENT 'post task code',
`post_task_version` int(11) NOT NULL COMMENT 'post task version',
`condition_type` tinyint(2) DEFAULT NULL COMMENT 'condition type : 0 none, 1 judge 2 delay',
`condition_params` text COMMENT 'condition params(json)',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'update time',
PRIMARY KEY (`id`),
KEY `idx_code` (`project_code`,`process_definition_code`),
KEY `idx_pre_task_code_version` (`pre_task_code`,`pre_task_version`),
KEY `idx_post_task_code_version` (`post_task_code`,`post_task_version`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
在这个表中,记录了工作流中每一个任务的上游以及其中 process_definition_code
为工作流的编码。其中的每一条记录,是不同任务(Task)之间的一个依赖关系,具体地:
- 如果一个任务没有上游依赖,那么会有一条
pre_task_code
为0
的记录 - 如果一个任务有多个上游依赖,那么会有多条
pre_task_code
不同单post_task_code
相同的记录
1.4.2 工作流与任务的关系历史表:t_ds_process_task_relation_log
字段含义与工作流与任务的关系表相同。
CREATE TABLE `t_ds_process_task_relation_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`name` varchar(255) DEFAULT NULL COMMENT 'relation name',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`process_definition_code` bigint(20) NOT NULL COMMENT 'process code',
`process_definition_version` int(11) NOT NULL COMMENT 'process version',
`pre_task_code` bigint(20) NOT NULL COMMENT 'pre task code',
`pre_task_version` int(11) NOT NULL COMMENT 'pre task version',
`post_task_code` bigint(20) NOT NULL COMMENT 'post task code',
`post_task_version` int(11) NOT NULL COMMENT 'post task version',
`condition_type` tinyint(2) DEFAULT NULL COMMENT 'condition type : 0 none, 1 judge 2 delay',
`condition_params` text COMMENT 'condition params(json)',
`operator` int(11) DEFAULT NULL COMMENT 'operator user id',
`operate_time` datetime DEFAULT NULL COMMENT 'operate time',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'update time',
PRIMARY KEY (`id`),
KEY `idx_process_code_version` (`process_definition_code`,`process_definition_version`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
1.5 工作流实例表:t_ds_process_instance
段名 | 字段类型 | 字段含义 |
---|---|---|
id | int(11) | 自增主键 |
name | varchar(255) | 工作流实例名称 |
process_definition_code | bigint(20) | 所属工作流定义 ID |
process_definition_version | int(11) | 所属工作流定义版本 |
project_code | bigint(20) | 所属项目 ID |
state | tinyint(4) | 状态:0 = 已提交,1 = 运行中,2 = 准备暂停,3 = 暂停,4 = 准备停止,5 = 停止,6 = 失败,7 = 成功,8 = 需要容错,9 = KILL,10 = 等待线程,11 = 等待依赖完成 |
state_history | text | 历史状态描述 |
recovery | tinyint(4) | 实例容错状态:0 = 正常,1 = 容错实例 |
start_time | datetime | 工作流实例开始时间 |
end_time | datetime | 工作流实例结束时间 |
run_times | int(11) | 工作流实例运行次数 |
host | varchar(135) | 工作流实例运行 host |
command_type | tinyint(4) | 任务类型 |
command_param | text | 任务参数 |
task_depend_type | tinyint(4) | 任务依赖类型:0 = only current node,1 = before the node,2 = later nodes |
max_try_times | tinyint(4) | 最大尝试次数 |
failure_strategy | tinyint(4) | 失败策略:0 = end the process when node failed,1 = continue running the other nodes when node failed |
warning_type | tinyint(4) | 告警类型:0 = no warning、1 = warning if process success,2 = warning if process |
warning_group_id | int(11) | 告警组 ID |
schedule_time | datetime | 调度运行时间 |
command_start_time | datetime | 命令开始时间 |
global_params | text | 全局参数 |
flag | ||
update_time | timestamp | 更新时间 |
is_sub_process | int(11) | 是否为子工作流实例的标记 |
executor_id | int(11) | Executor ID |
executor_name | varchar(64) | Executor 用户名 |
history_cmd | text | 工作流实例的历史命令 |
process_instance_priority | int(11) | 工作流实例的优先级 |
worker_group | varchar(255) | Worker 分组 |
environment_code | bigint(20) | 工作流实例使用的环境 ID |
timeout | int(11) | 超时时间 |
tenant_code | varchar(64) | tenant code |
var_pool | longtext | var_pool |
dry_run | tinyint(4) | dry run flag:0 normal, 1 dry run |
next_process_instance_id | int(11) | serial queue next processInstanceId |
restart_time | datetime | 工作流实例重启时间 |
test_flag | tinyint(4) | 测试标记:0 = 正常,1 = 测试 |
CREATE TABLE `t_ds_process_instance` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
`name` varchar(255) DEFAULT NULL COMMENT 'process instance name',
`process_definition_code` bigint(20) NOT NULL COMMENT 'process definition code',
`process_definition_version` int(11) NOT NULL DEFAULT '1' COMMENT 'process definition version',
`project_code` bigint(20) DEFAULT NULL COMMENT 'project code',
`state` tinyint(4) DEFAULT NULL COMMENT 'process instance Status: 0 commit succeeded, 1 running, 2 prepare to pause, 3 pause, 4 prepare to stop, 5 stop, 6 fail, 7 succeed, 8 need fault tolerance, 9 kill, 10 wait for thread, 11 wait for dependency to complete',
`state_history` text DEFAULT NULL COMMENT 'state history desc',
`recovery` tinyint(4) DEFAULT NULL COMMENT 'process instance failover flag:0:normal,1:failover instance',
`start_time` datetime DEFAULT NULL COMMENT 'process instance start time',
`end_time` datetime DEFAULT NULL COMMENT 'process instance end time',
`run_times` int(11) DEFAULT NULL COMMENT 'process instance run times',
`host` varchar(135) DEFAULT NULL COMMENT 'process instance host',
`command_type` tinyint(4) DEFAULT NULL COMMENT 'command type',
`command_param` text COMMENT 'json command parameters',
`task_depend_type` tinyint(4) DEFAULT NULL COMMENT 'task depend type. 0: only current node,1:before the node,2:later nodes',
`max_try_times` tinyint(4) DEFAULT '0' COMMENT 'max try times',
`failure_strategy` tinyint(4) DEFAULT '0' COMMENT 'failure strategy. 0:end the process when node failed,1:continue running the other nodes when node failed',
`warning_type` tinyint(4) DEFAULT '0' COMMENT 'warning type. 0:no warning,1:warning if process success,2:warning if process failed,3:warning if success',
`warning_group_id` int(11) DEFAULT NULL COMMENT 'warning group id',
`schedule_time` datetime DEFAULT NULL COMMENT 'schedule time',
`command_start_time` datetime DEFAULT NULL COMMENT 'command start time',
`global_params` text COMMENT 'global parameters',
`flag` tinyint(4) DEFAULT '1' COMMENT 'flag',
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`is_sub_process` int(11) DEFAULT '0' COMMENT 'flag, whether the process is sub process',
`executor_id` int(11) NOT NULL COMMENT 'executor id',
`executor_name` varchar(64) DEFAULT NULL COMMENT 'execute user name',
`history_cmd` text COMMENT 'history commands of process instance operation',
`process_instance_priority` int(11) DEFAULT '2' COMMENT 'process instance priority. 0 Highest,1 High,2 Medium,3 Low,4 Lowest',
`worker_group` varchar(255) DEFAULT NULL COMMENT 'worker group id',
`environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
`timeout` int(11) DEFAULT '0' COMMENT 'time out',
`tenant_code` varchar(64) DEFAULT 'default' COMMENT 'tenant code',
`var_pool` longtext COMMENT 'var_pool',
`dry_run` tinyint(4) DEFAULT '0' COMMENT 'dry run flag:0 normal, 1 dry run',
`next_process_instance_id` int(11) DEFAULT '0' COMMENT 'serial queue next processInstanceId',
`restart_time` datetime DEFAULT NULL COMMENT 'process instance restart time',
`test_flag` tinyint(4) DEFAULT null COMMENT 'test flag:0 normal, 1 test run',
PRIMARY KEY (`id`),
KEY `process_instance_index` (`process_definition_code`,`id`) USING BTREE,
KEY `start_time_index` (`start_time`,`end_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
1.6 任务实例表:t_ds_task_instance
段名 | 字段类型 | 字段含义 |
---|---|---|
id | int(11) | 自增主键 |
name | varchar(255) | 任务实例名称 |
task_type | varchar(50) | 任务实例类型 |
task_execute_type | int(11) | 任务实例执行类型:0 = 批,1 = 流 |
task_code | bigint(20) | 对应任务定义 ID |
task_definition_version | int(11) | 对应任务定义版本 |
process_instance_id | int(11) | 对应工作流实例 ID |
process_instance_name | varchar(255) | 对应工作流实例名称 |
project_code | bigint(20) | 所属项目 ID |
state | tinyint(4) | 任务实例当前状态:0 = 已提交,1 = 运行中,2 = 准备暂停,3 = 暂停,4 = 准备停止,5 = 停止,6 = 失败,7 = 成功,8 = 需要容错,9 = KILL,10 = 等待线程,11 = 等待依赖完成 |
submit_time | datetime | 任务提交时间 |
start_time | datetime | 任务开始时间 |
end_time | datetime | 任务结束时间 |
host | varchar(135) | 任务执行的服务器 HOST |
execute_path | varchar(200) | 任务执行的服务器路径 |
log_path | longtext | 任务的日志路径 |
alert_flag | tinyint(4) | 告警标记 |
retry_times | int(4) | 重试次数 |
pid | int(4) | 任务的进程号 |
app_link | text | Yarn 的 app id |
task_params | longtext | 任务执行的自定义参数 |
flag | tinyint(1) | 0 = 不可获得,1 = 可获得 |
is_cache | tinyint(2) | 0 = 不可获得,1 =可获得 |
cache_key | varchar(200) | cache_key |
retry_interval | int(4) | 任务失败后的重试间隔 |
max_retry_times | int(2) | 最大重试次数 |
task_instance_priority | int(11) | 任务实例优先级:0 = Higeest、1 = High、2 = Medium、3 = Low、4 = Lowest |
worker_group | varchar(255) | Worker 分组 |
environment_code | bigint(20) | 使用的环境 ID |
environment_config | text | 使用的环境配置 |
executor_id | int(11) | |
executor_name | varchar(64) | |
first_submit_time | datetime | 任务的首次提交时间 |
delay_time | int(4) | task delay execution time |
var_pool | longtext | var_pool |
task_group_id | int(11) | 任务组 ID |
dry run | tinyint(4) | dry run flag: 0 normal, 1 dry run |
cpu_quota | int(11) | CPU 配额:-1 = 无限制 |
memory_max | int(11) | 内存限制:-1 = 无限制 |
test_flag | tinyint(4) | 测试标记:0 = 正常,1 = 测试 |
CREATE TABLE `t_ds_task_instance` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
`name` varchar(255) DEFAULT NULL COMMENT 'task name',
`task_type` varchar(50) NOT NULL COMMENT 'task type',
`task_execute_type` int(11) DEFAULT '0' COMMENT 'task execute type: 0-batch, 1-stream',
`task_code` bigint(20) NOT NULL COMMENT 'task definition code',
`task_definition_version` int(11) NOT NULL DEFAULT '1' COMMENT 'task definition version',
`process_instance_id` int(11) DEFAULT NULL COMMENT 'process instance id',
`process_instance_name` varchar(255) DEFAULT NULL COMMENT 'process instance name',
`project_code` bigint(20) DEFAULT NULL COMMENT 'project code',
`state` tinyint(4) DEFAULT NULL COMMENT 'Status: 0 commit succeeded, 1 running, 2 prepare to pause, 3 pause, 4 prepare to stop, 5 stop, 6 fail, 7 succeed, 8 need fault tolerance, 9 kill, 10 wait for thread, 11 wait for dependency to complete',
`submit_time` datetime DEFAULT NULL COMMENT 'task submit time',
`start_time` datetime DEFAULT NULL COMMENT 'task start time',
`end_time` datetime DEFAULT NULL COMMENT 'task end time',
`host` varchar(135) DEFAULT NULL COMMENT 'host of task running on',
`execute_path` varchar(200) DEFAULT NULL COMMENT 'task execute path in the host',
`log_path` longtext DEFAULT NULL COMMENT 'task log path',
`alert_flag` tinyint(4) DEFAULT NULL COMMENT 'whether alert',
`retry_times` int(4) DEFAULT '0' COMMENT 'task retry times',
`pid` int(4) DEFAULT NULL COMMENT 'pid of task',
`app_link` text COMMENT 'yarn app id',
`task_params` longtext COMMENT 'job custom parameters',
`flag` tinyint(4) DEFAULT '1' COMMENT '0 not available, 1 available',
`is_cache` tinyint(2) DEFAULT '0' COMMENT '0 not available, 1 available',
`cache_key` varchar(200) DEFAULT NULL COMMENT 'cache_key',
`retry_interval` int(4) DEFAULT NULL COMMENT 'retry interval when task failed ',
`max_retry_times` int(2) DEFAULT NULL COMMENT 'max retry times',
`task_instance_priority` int(11) DEFAULT NULL COMMENT 'task instance priority:0 Highest,1 High,2 Medium,3 Low,4 Lowest',
`worker_group` varchar(255) DEFAULT NULL COMMENT 'worker group id',
`environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
`environment_config` text COMMENT 'this config contains many environment variables config',
`executor_id` int(11) DEFAULT NULL,
`executor_name` varchar(64) DEFAULT NULL,
`first_submit_time` datetime DEFAULT NULL COMMENT 'task first submit time',
`delay_time` int(4) DEFAULT '0' COMMENT 'task delay execution time',
`var_pool` longtext COMMENT 'var_pool',
`task_group_id` int(11) DEFAULT NULL COMMENT 'task group id',
`dry_run` tinyint(4) DEFAULT '0' COMMENT 'dry run flag: 0 normal, 1 dry run',
`cpu_quota` int(11) DEFAULT '-1' NOT NULL COMMENT 'cpuQuota(%): -1:Infinity',
`memory_max` int(11) DEFAULT '-1' NOT NULL COMMENT 'MemoryMax(MB): -1:Infinity',
`test_flag` tinyint(4) DEFAULT null COMMENT 'test flag:0 normal, 1 test run',
PRIMARY KEY (`id`),
KEY `process_instance_id` (`process_instance_id`) USING BTREE,
KEY `idx_code_version` (`task_code`, `task_definition_version`) USING BTREE,
KEY `idx_cache_key` (`cache_key`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;