feat: STF设备管理彻底删除(脚本+断开+STF API清记录)+ 一键重连(后台跑connect脚本)+ 跳过原因日志区分离线/未就绪 + SSH超时错误分类
This commit is contained in:
+19
-9
@@ -156,19 +156,29 @@ class TaskJob:
|
||||
return [d["serial"] for d in manager.stf.list_free_devices()]
|
||||
except Exception:
|
||||
return []
|
||||
# 离线自动跳过(serial/group 模式):跳过 STF 池里不在线(present=False)的设备,
|
||||
# 避免对离线设备反复尝试占用后报"设备离线"。默认开启,可在任务编辑器取消勾选。
|
||||
# 离线自动跳过(serial/group 模式):跳过 STF 池里不在线(present=False)或
|
||||
# 未就绪(ready=False,provider 刚接入还在初始化)的设备,
|
||||
# 避免对离线/未就绪设备反复尝试占用后报"设备离线"。默认开启,可在任务编辑器取消勾选。
|
||||
if serials and self.params.get("skip_offline", True):
|
||||
try:
|
||||
online = {d["serial"] for d in manager.stf.list_all_devices()
|
||||
if d.get("present") and d.get("ready")}
|
||||
devs = manager.stf.list_all_devices()
|
||||
except Exception:
|
||||
online = None # STF 查询失败时不过滤,维持原行为
|
||||
if online is not None:
|
||||
skipped = [s for s in serials if s not in online]
|
||||
devs = None # STF 查询失败时不过滤,维持原行为
|
||||
if devs is not None:
|
||||
present = {d["serial"] for d in devs if d.get("present")}
|
||||
ready = {d["serial"] for d in devs if d.get("present") and d.get("ready")}
|
||||
kept, skipped = [], []
|
||||
for s in serials:
|
||||
if s not in present:
|
||||
skipped.append((s, "离线"))
|
||||
elif s not in ready:
|
||||
skipped.append((s, "未就绪(provider初始化中)"))
|
||||
else:
|
||||
kept.append(s)
|
||||
if skipped:
|
||||
_log.info(f"任务 {self.name} 离线自动跳过 {len(skipped)} 台设备: {skipped}")
|
||||
serials = [s for s in serials if s in online]
|
||||
detail = ", ".join(f"{s}({why})" for s, why in skipped)
|
||||
_log.info(f"任务 {self.name} 跳过 {len(skipped)} 台设备: {detail}")
|
||||
serials = kept
|
||||
return serials
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user