fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 (E302, E305, E501) - 修复行长度超过100字符的问题 - 修复F821未定义名称错误
This commit is contained in:
@@ -38,6 +38,7 @@ DEFAULT_RETRY_DELAY = 5 # 默认重试延迟(秒)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class WorkflowStatus(Enum):
|
||||
"""工作流状态"""
|
||||
|
||||
@@ -46,6 +47,7 @@ class WorkflowStatus(Enum):
|
||||
ERROR = "error"
|
||||
COMPLETED = "completed"
|
||||
|
||||
|
||||
class WorkflowType(Enum):
|
||||
"""工作流类型"""
|
||||
|
||||
@@ -55,6 +57,7 @@ class WorkflowType(Enum):
|
||||
SCHEDULED_REPORT = "scheduled_report" # 定时报告
|
||||
CUSTOM = "custom" # 自定义工作流
|
||||
|
||||
|
||||
class WebhookType(Enum):
|
||||
"""Webhook 类型"""
|
||||
|
||||
@@ -63,6 +66,7 @@ class WebhookType(Enum):
|
||||
SLACK = "slack"
|
||||
CUSTOM = "custom"
|
||||
|
||||
|
||||
class TaskStatus(Enum):
|
||||
"""任务执行状态"""
|
||||
|
||||
@@ -72,6 +76,7 @@ class TaskStatus(Enum):
|
||||
FAILED = "failed"
|
||||
CANCELLED = "cancelled"
|
||||
|
||||
|
||||
@dataclass
|
||||
class WorkflowTask:
|
||||
"""工作流任务定义"""
|
||||
@@ -95,6 +100,7 @@ class WorkflowTask:
|
||||
if not self.updated_at:
|
||||
self.updated_at = self.created_at
|
||||
|
||||
|
||||
@dataclass
|
||||
class WebhookConfig:
|
||||
"""Webhook 配置"""
|
||||
@@ -119,6 +125,7 @@ class WebhookConfig:
|
||||
if not self.updated_at:
|
||||
self.updated_at = self.created_at
|
||||
|
||||
|
||||
@dataclass
|
||||
class Workflow:
|
||||
"""工作流定义"""
|
||||
@@ -148,6 +155,7 @@ class Workflow:
|
||||
if not self.updated_at:
|
||||
self.updated_at = self.created_at
|
||||
|
||||
|
||||
@dataclass
|
||||
class WorkflowLog:
|
||||
"""工作流执行日志"""
|
||||
@@ -168,6 +176,7 @@ class WorkflowLog:
|
||||
if not self.created_at:
|
||||
self.created_at = datetime.now().isoformat()
|
||||
|
||||
|
||||
class WebhookNotifier:
|
||||
"""Webhook 通知器 - 支持飞书、钉钉、Slack"""
|
||||
|
||||
@@ -323,6 +332,7 @@ class WebhookNotifier:
|
||||
"""关闭 HTTP 客户端"""
|
||||
await self.http_client.aclose()
|
||||
|
||||
|
||||
class WorkflowManager:
|
||||
"""工作流管理器 - 核心管理类"""
|
||||
|
||||
@@ -1493,9 +1503,11 @@ class WorkflowManager:
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# Singleton instance
|
||||
_workflow_manager = None
|
||||
|
||||
|
||||
def get_workflow_manager(db_manager=None) -> WorkflowManager:
|
||||
"""获取 WorkflowManager 单例"""
|
||||
global _workflow_manager
|
||||
|
||||
Reference in New Issue
Block a user