45 lines
1.5 KiB
Python
Raw Permalink Normal View History

2025-04-30 16:57:46 +08:00
#!/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='日志消息内容')
2025-05-12 15:43:21 +08:00
task_block_id = Column(String(255), comment='任务块ID')
2025-04-30 16:57:46 +08:00
task_id = Column(String(255), comment='对应的任务定义ID')
task_record_id = Column(String(255), comment='对应的任务执行记录ID')
2025-05-12 15:43:21 +08:00
block_record_id = Column(String(255), comment='对应的任务块执行记录ID')
2025-04-30 16:57:46 +08:00
def __repr__(self):
return f"<VWEDTaskLog(id='{self.id}', level='{self.level}')>"