阶段3: 摘除 STF——删除 stf_client/stf_device_mgmt 与全部引用(STF 容器重启/设备管理/强制释放占用/agent 按钮/占用列),调度与设备管理完全基于本地设备池+adb;错误类迁入 device_worker,create_worker 去 stf 参数

This commit is contained in:
2026-08-18 08:08:32 +08:00
parent 98244d8161
commit a5ce57b6fd
17 changed files with 71 additions and 956 deletions
+3 -8
View File
@@ -29,7 +29,6 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
from config import APK_DIR, ADB_PATH
from core.logger import get_logger
from core.models import db, ApkFile as ApkRow
from .stf_client import STFClient
from .device_worker import get_all_worker_status
_log = get_logger("core.apk")
@@ -43,8 +42,7 @@ _INSTALL_CONCURRENCY = 5
class ApkManager:
"""APK 文件管理 + 批量安装。"""
def __init__(self, stf_client=None, app=None):
self.stf = stf_client or STFClient()
def __init__(self, app=None):
self.app = app # Flask app,用于 db context
os.makedirs(APK_DIR, exist_ok=True)
self._lock = threading.Lock()
@@ -194,11 +192,8 @@ class ApkManager:
if not serials:
return False, "未选择设备"
# 获取设备信息(型号等)
try:
all_devices = {d["serial"]: d for d in self.stf.list_all_devices()}
except Exception:
all_devices = {}
# 设备信息(型号从 worker 状态取,池内无型号信息)
all_devices = {}
# 获取 worker 状态(判断设备是否运行中)
worker_status = {w["serial"]: w for w in get_all_worker_status()}