fix(scheduler): 修复setup_schedule未传递no_detail/no_report参数的问题
setup_schedule() 在定时模式下未将 --no-detail 和 --no-report 参数传递给 daily_task,导致定时任务始终生成 detail JSON
This commit is contained in:
@@ -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",
|
def setup_schedule(target_time: str = "15:30",
|
||||||
config_path: str = "strategies/rotation/config.yaml",
|
config_path: str = "strategies/rotation/config.yaml",
|
||||||
strategy: str = "all",
|
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策略配置文件路径
|
config_path: legacy策略配置文件路径
|
||||||
strategy: 策略选择 - "simple" / "legacy" / "all"
|
strategy: 策略选择 - "simple" / "legacy" / "all"
|
||||||
simple_config: simple_rotation 配置文件路径
|
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()
|
schedule.clear()
|
||||||
@@ -276,7 +280,9 @@ def setup_schedule(target_time: str = "15:30",
|
|||||||
daily_task,
|
daily_task,
|
||||||
config_path=config_path,
|
config_path=config_path,
|
||||||
strategy=strategy,
|
strategy=strategy,
|
||||||
simple_config=simple_config
|
simple_config=simple_config,
|
||||||
|
no_detail=no_detail,
|
||||||
|
no_report=no_report
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info("定时任务设置完成,等待执行...")
|
logger.info("定时任务设置完成,等待执行...")
|
||||||
@@ -407,14 +413,14 @@ def main():
|
|||||||
daily_task(args.config, args.strategy, args.simple_config, args.no_detail, args.no_report)
|
daily_task(args.config, args.strategy, args.simple_config, args.no_detail, args.no_report)
|
||||||
elif args.no_daemon:
|
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("执行一次测试...")
|
logger.info("执行一次测试...")
|
||||||
daily_task(args.config, args.strategy, args.simple_config, args.no_detail, args.no_report)
|
daily_task(args.config, args.strategy, args.simple_config, args.no_detail, args.no_report)
|
||||||
logger.info("测试完成,启动定时任务循环(Ctrl+C 停止)...")
|
logger.info("测试完成,启动定时任务循环(Ctrl+C 停止)...")
|
||||||
run_scheduler_loop()
|
run_scheduler_loop()
|
||||||
else:
|
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()
|
run_scheduler_loop()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user