59 lines
2.6 KiB
Python
59 lines
2.6 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
任务块执行记录模型
|
|
对应vwed_blockrecord表
|
|
"""
|
|
|
|
import datetime
|
|
from sqlalchemy import Column, String, Integer, Index
|
|
from sqlalchemy.dialects.mysql import LONGTEXT, DATETIME
|
|
from data.models.base import BaseModel
|
|
|
|
|
|
class VWEDBlockRecord(BaseModel):
|
|
"""
|
|
任务块执行记录模型
|
|
对应vwed_blockrecord表
|
|
功能:记录任务块的执行情况,一个任务由多个任务块组成
|
|
"""
|
|
__tablename__ = 'vwed_blockrecord'
|
|
|
|
__table_args__ = (
|
|
Index('idx_vwed_blockrecord_task_id', 'task_id'),
|
|
Index('idx_vwed_blockrecord_task_record_id', 'task_record_id'),
|
|
Index('idx_vwed_blockrecord_status', 'status'),
|
|
Index('idx_vwed_blockrecord_block_id', 'block_id'),
|
|
Index('idx_vwed_blockrecord_created_at', 'created_at'),
|
|
{
|
|
'mysql_engine': 'InnoDB',
|
|
'mysql_charset': 'utf8mb4',
|
|
'mysql_collate': 'utf8mb4_general_ci',
|
|
'info': {'order_by': 'created_at DESC'}
|
|
}
|
|
)
|
|
id = Column(String(255), primary_key=True, nullable=False, comment='记录ID')
|
|
block_name = Column(String(255), comment='块名称')
|
|
block_id = Column(String(255), comment='块ID')
|
|
block_config_id = Column(String(255), comment='块配置ID')
|
|
block_input_params = Column(LONGTEXT, comment='块输入参数')
|
|
block_input_params_value = Column(LONGTEXT, comment='块输入参数值')
|
|
block_out_params_value = Column(LONGTEXT, comment='块输出参数值')
|
|
block_internal_variables = Column(LONGTEXT, comment='块内部变量')
|
|
block_execute_name = Column(String(255), comment='块执行名称')
|
|
task_id = Column(String(255), comment='关联的任务定义ID')
|
|
task_record_id = Column(String(255), comment='关联的任务记录ID')
|
|
started_on = Column(DATETIME(fsp=6), comment='开始时间')
|
|
ended_on = Column(DATETIME(fsp=6), comment='结束时间')
|
|
ended_reason = Column(LONGTEXT, comment='结束原因')
|
|
status = Column(Integer, comment='块执行状态, 1000: 执行成功, 1001: 执行中, 1006: 未执行, 2000: 执行失败, 2002: 取消')
|
|
ctrl_status = Column(Integer, comment='控制状态')
|
|
input_params = Column(LONGTEXT, comment='输入参数')
|
|
internal_variables = Column(LONGTEXT, comment='内部变量')
|
|
output_params = Column(LONGTEXT, comment='输出参数')
|
|
version = Column(Integer, comment='版本号', default=1)
|
|
remark = Column(LONGTEXT, comment='备注')
|
|
|
|
def __repr__(self):
|
|
return f"<VWEDBlockRecord(id='{self.id}', block_name='{self.block_name}', status='{self.status}')>" |