fix: 任务调度限定设备池——preempt 抢占模式的 all 目标原用 list_online()(含待连接/未入池设备,自动发现验证连上的设备会被任务误跑);改为设备池内在线设备;group 模式同样过滤未入池设备(serial 模式保留显式指定)
This commit is contained in:
+13
-1
@@ -154,12 +154,24 @@ class TaskJob:
|
||||
elif mode == "group":
|
||||
g = manager.groups.get(self.target.get("group_name"))
|
||||
serials = list(g.serials) if g else []
|
||||
# 分组应引用设备池内设备:不在池内的(如手动填的旧 IP)不参与调度,
|
||||
# 与 all/preempt 模式口径一致(2026-09-01)
|
||||
try:
|
||||
configured = set(device_pool.list_configured())
|
||||
serials = [s for s in serials if s in configured]
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
# all:默认返回池内在线设备(单实例互斥由 _run_with_retry 的 _running 保证);
|
||||
# 抢占模式返回全部在线设备(含运行中,执行时抢占)
|
||||
if self.params.get("preempt"):
|
||||
try:
|
||||
return device_pool.list_online()
|
||||
# 抢占模式:只抢设备池内的在线设备——
|
||||
# list_online() 会包含待连接/未入池设备(如自动发现验证时连上的),
|
||||
# 它们不在设备池就不该被任务调度(2026-09-01 修复)
|
||||
online = set(device_pool.list_online())
|
||||
configured = set(device_pool.list_configured())
|
||||
return [s for s in device_pool.list_online() if s in configured]
|
||||
except Exception:
|
||||
return []
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user