阶段3: 摘除 STF——删除 stf_client/stf_device_mgmt 与全部引用(STF 容器重启/设备管理/强制释放占用/agent 按钮/占用列),调度与设备管理完全基于本地设备池+adb;错误类迁入 device_worker,create_worker 去 stf 参数
This commit is contained in:
+3
-3
@@ -49,8 +49,8 @@
|
||||
from .actions import get_action_class
|
||||
return get_action_class(action_type)
|
||||
|
||||
def create_worker(self, stf, serial, params):
|
||||
return MyWorker(stf, serial, params=params)
|
||||
def create_worker(self, serial, params):
|
||||
return MyWorker(serial, params=params)
|
||||
|
||||
5. 在 my_task/__init__.py 加:from . import task (触发注册)
|
||||
6. 在 tasks/__init__.py 加:from .my_task import task (触发注册)
|
||||
@@ -85,7 +85,7 @@ class BaseTask:
|
||||
description = ""
|
||||
default_params = {}
|
||||
|
||||
def create_worker(self, stf, serial, params):
|
||||
def create_worker(self, serial, params):
|
||||
"""返回一个 threading.Thread(已启动或待启动),执行实际任务。"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ class DouyinNurtureWorker(BaseWorker):
|
||||
操作参数优先级:任务 params.actions > 本文件 DEFAULT_PARAMS.actions。
|
||||
"""
|
||||
|
||||
def __init__(self, stf_client, serial, params=None):
|
||||
super().__init__(stf_client, serial, params)
|
||||
def __init__(self, serial, params=None):
|
||||
super().__init__(serial, params)
|
||||
p = {**DEFAULT_PARAMS, **(self.params or {})}
|
||||
self.watch_count = int(p["watch_count"])
|
||||
self.watch_min = float(p["watch_min"])
|
||||
@@ -244,7 +244,7 @@ class DouyinNurtureTask(BaseTask):
|
||||
"""按 action_type 取抖音操作类。"""
|
||||
return get_action_class(action_type)
|
||||
|
||||
def create_worker(self, stf, serial, params):
|
||||
def create_worker(self, serial, params):
|
||||
merged = {**DEFAULT_PARAMS, **(params or {})}
|
||||
# actions 字段深合并(参数级,保留前端没传的操作默认值)
|
||||
# 确保即使前端只传 actions.like.enabled,like.params.rate 也能拿到默认 0.3
|
||||
@@ -266,4 +266,4 @@ class DouyinNurtureTask(BaseTask):
|
||||
merged_cfg["params"] = merged_params
|
||||
merged_actions[atype] = merged_cfg
|
||||
merged["actions"] = merged_actions
|
||||
return DouyinNurtureWorker(stf, serial, params=merged)
|
||||
return DouyinNurtureWorker(serial, params=merged)
|
||||
|
||||
@@ -110,8 +110,8 @@ class GenericStepsWorker(BaseWorker):
|
||||
只实现 run_task,按步骤类型分发到 _exec_<type> 方法。
|
||||
"""
|
||||
|
||||
def __init__(self, stf_client, serial, params=None):
|
||||
super().__init__(stf_client, serial, params)
|
||||
def __init__(self, serial, params=None):
|
||||
super().__init__(serial, params)
|
||||
p = {**DEFAULT_PARAMS, **(self.params or {})}
|
||||
self.max_duration = int(p.get("max_duration", 0))
|
||||
self.steps = p.get("steps", [])
|
||||
@@ -614,9 +614,9 @@ class GenericStepsTask(BaseTask):
|
||||
def get_action_class(cls, action_type):
|
||||
return None
|
||||
|
||||
def create_worker(self, stf, serial, params):
|
||||
def create_worker(self, serial, params):
|
||||
merged = {**DEFAULT_PARAMS, **(params or {})}
|
||||
return GenericStepsWorker(stf, serial, params=merged)
|
||||
return GenericStepsWorker(serial, params=merged)
|
||||
|
||||
|
||||
def test_step(serial, step):
|
||||
|
||||
Reference in New Issue
Block a user