2025-05-12 15:43:21 +08:00

45 lines
1.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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(String(255), comment='任务块ID')
task_id = Column(String(255), comment='对应的任务定义ID')
task_record_id = Column(String(255), comment='对应的任务执行记录ID')
block_record_id = Column(String(255), comment='对应的任务块执行记录ID')
def __repr__(self):
return f"<VWEDTaskLog(id='{self.id}', level='{self.level}')>"