mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-04-13 17:52:28 +08:00
fix workflow scheduler
This commit is contained in:
@@ -99,7 +99,7 @@ def start_workflow(workflow_id: int,
|
||||
workflow = Workflow.get(db, workflow_id)
|
||||
if not workflow:
|
||||
return schemas.Response(success=False, message="工作流不存在")
|
||||
Scheduler().remove_workflow_job(workflow)
|
||||
Scheduler().update_workflow_job(workflow)
|
||||
workflow.update_state(db, workflow_id, "W")
|
||||
return schemas.Response(success=True)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class Workflow(Base):
|
||||
timer = Column(String)
|
||||
# 状态:W-等待 R-运行中 P-暂停 S-成功 F-失败
|
||||
state = Column(String, nullable=False, index=True, default='W')
|
||||
# 当前执行动作
|
||||
# 已执行动作(,分隔)
|
||||
current_action = Column(String)
|
||||
# 任务执行结果
|
||||
result = Column(String)
|
||||
|
||||
@@ -494,6 +494,9 @@ class Scheduler(metaclass=Singleton):
|
||||
"""
|
||||
更新工作流定时服务
|
||||
"""
|
||||
if not self._scheduler:
|
||||
return
|
||||
|
||||
# 移除该工作流的全部服务
|
||||
self.remove_workflow_job(workflow)
|
||||
# 添加工作流服务
|
||||
|
||||
@@ -20,7 +20,7 @@ class Workflow(BaseModel):
|
||||
description: Optional[str] = Field(None, description="工作流描述")
|
||||
timer: Optional[str] = Field(None, description="定时器")
|
||||
state: Optional[str] = Field(None, description="状态")
|
||||
current_action: Optional[str] = Field(None, description="当前执行动作")
|
||||
current_action: Optional[str] = Field(None, description="已执行动作")
|
||||
result: Optional[str] = Field(None, description="任务执行结果")
|
||||
run_count: Optional[int] = Field(0, description="已执行次数")
|
||||
actions: Optional[list] = Field([], description="任务列表")
|
||||
|
||||
Reference in New Issue
Block a user