fix(计划): 构建计划时读取 ae_profile 全局切号参数
- 新增 account_folder.current_profile()(读库 + 合并默认值) - build_plan_job / ready_defaults 改用它,页面保存的切号选择器真正生效 - 手动按设备/账号跑也回落到 db 配置 - test_plan 增加 ae_profile 全局参数回归
This commit is contained in:
+18
-2
@@ -85,6 +85,22 @@ DEFAULT_PROFILE = {
|
||||
}
|
||||
|
||||
|
||||
def current_profile():
|
||||
"""读 `ae_profile` 的**当前配置**并与默认值合并。
|
||||
|
||||
计划/调度在构建步骤时必须用这个,而不是 `merged()`(后者只看传入的 dict,
|
||||
根本没读库)—— 否则页面「切号 / 发布前准备参数」里保存的全局值不会生效。
|
||||
"""
|
||||
from core.models import AeProfile
|
||||
try:
|
||||
with _ctx():
|
||||
row = AeProfile.query.filter_by(id="default").first()
|
||||
return merged(row.get_params() if row else None)
|
||||
except Exception as e:
|
||||
_log.debug("读取流水线配置失败(回落默认值): %s", e)
|
||||
return merged()
|
||||
|
||||
|
||||
def merged(profile=None):
|
||||
"""把存下来的配置与默认值**深合并**(只补缺的键,用户填的优先)。"""
|
||||
def _deep(base, over):
|
||||
@@ -2169,7 +2185,7 @@ def run_account_once(account, action_id="", profile=None, serial=None, date="",
|
||||
这里是**账号在外**(谁登着这个号谁跑),那里是**设备在外**(这台机器要跑哪几个号)。
|
||||
"""
|
||||
from core import video_plan as vp
|
||||
prof = merged(profile)
|
||||
prof = merged(profile) if profile else current_profile()
|
||||
date = (date or "").strip() or vp._today()
|
||||
run_id = (run_id or "").strip() or uuid.uuid4().hex[:12]
|
||||
if not serial:
|
||||
@@ -2264,7 +2280,7 @@ def _run_with_serial(serial, accounts, action_id, profile, date, run_id=""):
|
||||
from core import video_plan as vp
|
||||
from core.models import AeRun, CustomAction, AeApp, db
|
||||
from tasks import get_task_class
|
||||
prof = merged(profile)
|
||||
prof = merged(profile) if profile else current_profile()
|
||||
date = (date or "").strip() or vp._today()
|
||||
run_id = (run_id or "").strip() or uuid.uuid4().hex[:12]
|
||||
started = _now()
|
||||
|
||||
Reference in New Issue
Block a user