From 5c4aeb75d2f42e4cb48a1fbc945172e022f690d5 Mon Sep 17 00:00:00 2001 From: aszerW Date: Tue, 9 Jun 2026 00:07:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(scheduler):=20=E4=BF=AE=E5=A4=8Dsetup=5Fsch?= =?UTF-8?q?edule=E6=9C=AA=E4=BC=A0=E9=80=92no=5Fdetail/no=5Freport?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setup_schedule() 在定时模式下未将 --no-detail 和 --no-report 参数传递给 daily_task,导致定时任务始终生成 detail JSON --- rotation/daily_scheduler.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/rotation/daily_scheduler.py b/rotation/daily_scheduler.py index 967bb29..08b4589 100644 --- a/rotation/daily_scheduler.py +++ b/rotation/daily_scheduler.py @@ -256,7 +256,9 @@ def send_report_to_dingtalk(chart_path: str, summary_text: str = "", title: str def setup_schedule(target_time: str = "15:30", config_path: str = "strategies/rotation/config.yaml", strategy: str = "all", - simple_config: str = None): + simple_config: str = None, + no_detail: bool = False, + no_report: bool = False): """ 设置定时任务 @@ -265,8 +267,10 @@ def setup_schedule(target_time: str = "15:30", config_path: legacy策略配置文件路径 strategy: 策略选择 - "simple" / "legacy" / "all" simple_config: simple_rotation 配置文件路径 + no_detail: 跳过 detail JSON 导出 + no_report: 跳过 report PNG 生成 """ - logger.info(f"设置定时任务: 每天 {target_time} 执行 (策略: {strategy})") + logger.info(f"设置定时任务: 每天 {target_time} 执行 (策略: {strategy}, no_detail={no_detail}, no_report={no_report})") # 清除已有任务 schedule.clear() @@ -276,7 +280,9 @@ def setup_schedule(target_time: str = "15:30", daily_task, config_path=config_path, strategy=strategy, - simple_config=simple_config + simple_config=simple_config, + no_detail=no_detail, + no_report=no_report ) logger.info("定时任务设置完成,等待执行...") @@ -407,14 +413,14 @@ def main(): daily_task(args.config, args.strategy, args.simple_config, args.no_detail, args.no_report) elif args.no_daemon: # 非后台模式:执行一次后进入定时循环 - setup_schedule(args.time, args.config, args.strategy, args.simple_config) + setup_schedule(args.time, args.config, args.strategy, args.simple_config, args.no_detail, args.no_report) logger.info("执行一次测试...") daily_task(args.config, args.strategy, args.simple_config, args.no_detail, args.no_report) logger.info("测试完成,启动定时任务循环(Ctrl+C 停止)...") run_scheduler_loop() else: # 默认:后台定时模式 - setup_schedule(args.time, args.config, args.strategy, args.simple_config) + setup_schedule(args.time, args.config, args.strategy, args.simple_config, args.no_detail, args.no_report) run_scheduler_loop()