44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
|
#!/usr/bin/env python
|
|||
|
# -*- coding: utf-8 -*-
|
|||
|
|
|||
|
"""
|
|||
|
任务日志模型
|
|||
|
对应vwed_tasklog表
|
|||
|
"""
|
|||
|
|
|||
|
import datetime
|
|||
|
from sqlalchemy import Column, String, Integer, DateTime, Index
|
|||
|
from sqlalchemy.dialects.mysql import LONGTEXT
|
|||
|
from data.models.base import BaseModel
|
|||
|
|
|||
|
|
|||
|
class VWEDTaskLog(BaseModel):
|
|||
|
"""
|
|||
|
任务日志模型
|
|||
|
对应vwed_tasklog表
|
|||
|
功能:记录任务执行过程中的详细日志信息,用于监控和调试
|
|||
|
"""
|
|||
|
__tablename__ = 'vwed_tasklog'
|
|||
|
|
|||
|
__table_args__ = (
|
|||
|
Index('idx_vwed_tasklog_task_id', 'task_id'),
|
|||
|
Index('idx_vwed_tasklog_task_record_id', 'task_record_id'),
|
|||
|
Index('idx_vwed_tasklog_level', 'level'),
|
|||
|
Index('idx_vwed_tasklog_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')
|
|||
|
level = Column(Integer, comment='日志级别(1: 信息, 3: 错误等)')
|
|||
|
message = Column(LONGTEXT, comment='日志消息内容')
|
|||
|
task_block_id = Column(Integer, comment='任务块ID')
|
|||
|
task_id = Column(String(255), comment='对应的任务定义ID')
|
|||
|
task_record_id = Column(String(255), comment='对应的任务执行记录ID')
|
|||
|
|
|||
|
def __repr__(self):
|
|||
|
return f"<VWEDTaskLog(id='{self.id}', level='{self.level}')>"
|