feat(流水线): 资产管理 + 计划编排 + 运行监测 + 切号/发布修复
- 流水线收口为四栏:资产管理 / 动作 / 计划调度 / 运行监测 - 资产管理:账号总表与设备筛选、素材 13 列、模板批量导入(数量+文件名校验)、 单条上传、删除账号(归档不删原件)、发布记录 - 计划调度:segments 多动作组/任务编排(发布素材/循环/条件/回主页)、 内置切号可见可编辑、每账号切号前亮屏 - 运行监测:计划/账号/设备三维度、按需截图、按账号拆分显示 - 修复:图片相册索引误报、切号重试与重复点「我」、发布任务校验跳过、 多号同机假账号目录、编辑器 expect_el 未声明变量 - 文档与测试同步(14/14)
This commit is contained in:
+9
-3
@@ -70,7 +70,7 @@ def stats():
|
||||
|
||||
# ================== 写入侧 ==================
|
||||
|
||||
def record(run_id="", job_id="", job_name="", serial="", device_name="",
|
||||
def record(run_id="", job_id="", job_name="", serial="", device_name="", account="",
|
||||
step_path="", step_label="", step_type="", selector="",
|
||||
result="", detail="", duration_ms=0):
|
||||
"""记录一次步骤执行。**任务线程直接调用**——零阻塞、零 DB、不抛异常。
|
||||
@@ -84,6 +84,7 @@ def record(run_id="", job_id="", job_name="", serial="", device_name="",
|
||||
"job_name": (job_name or "")[:120],
|
||||
"serial": (serial or "")[:120],
|
||||
"device_name": (device_name or "")[:80],
|
||||
"account": (account or "")[:80],
|
||||
"step_path": (step_path or "")[:32],
|
||||
"step_label": (step_label or "")[:120],
|
||||
"step_type": (step_type or "")[:40],
|
||||
@@ -150,7 +151,7 @@ def _writer_loop():
|
||||
|
||||
# ================== 查询(给 API 用,在请求线程里跑) ==================
|
||||
|
||||
def query(serial="", job_id="", result="", run_id="", keyword="",
|
||||
def query(serial="", job_id="", result="", run_id="", account="", keyword="",
|
||||
since="", until="", limit=200, offset=0):
|
||||
"""按条件查明细,返回 (rows, total)。**倒序**(最近的在前)。"""
|
||||
from sqlalchemy import or_
|
||||
@@ -160,6 +161,8 @@ def query(serial="", job_id="", result="", run_id="", keyword="",
|
||||
q = q.filter(TaskStepLog.serial == serial)
|
||||
if job_id:
|
||||
q = q.filter(TaskStepLog.job_id == job_id)
|
||||
if account:
|
||||
q = q.filter(TaskStepLog.account == account)
|
||||
if result:
|
||||
q = q.filter(TaskStepLog.result == result)
|
||||
if run_id:
|
||||
@@ -183,7 +186,7 @@ def query(serial="", job_id="", result="", run_id="", keyword="",
|
||||
return rows, total
|
||||
|
||||
|
||||
def runs(serial="", job_id="", since="", until="", limit=100):
|
||||
def runs(serial="", job_id="", account="", since="", until="", limit=100):
|
||||
"""按 run_id 归组的一次运行概览(哪次运行失败、失败几步)。
|
||||
|
||||
用一次 GROUP BY 查出来,避免前端按明细自己聚合。
|
||||
@@ -198,6 +201,7 @@ def runs(serial="", job_id="", since="", until="", limit=100):
|
||||
func.max(TaskStepLog.job_id).label("job_id"),
|
||||
func.max(TaskStepLog.serial).label("serial"),
|
||||
func.max(TaskStepLog.device_name).label("device_name"),
|
||||
func.max(TaskStepLog.account).label("account"),
|
||||
func.count(TaskStepLog.id).label("steps"),
|
||||
func.sum(case((TaskStepLog.result.in_(("error", "miss", "unknown")), 1),
|
||||
else_=0)).label("failures"),
|
||||
@@ -206,6 +210,8 @@ def runs(serial="", job_id="", since="", until="", limit=100):
|
||||
q = q.filter(TaskStepLog.serial == serial)
|
||||
if job_id:
|
||||
q = q.filter(TaskStepLog.job_id == job_id)
|
||||
if account:
|
||||
q = q.filter(TaskStepLog.account == account)
|
||||
if since:
|
||||
q = q.filter(TaskStepLog.created_at >= since)
|
||||
if until:
|
||||
|
||||
Reference in New Issue
Block a user