From de347400bd517bceab1690c9554cc0c5d98056b4 Mon Sep 17 00:00:00 2001 From: yhydev Date: Fri, 12 Dec 2025 17:01:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run_script.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/run_script.py b/run_script.py index af4ab77..85e101b 100644 --- a/run_script.py +++ b/run_script.py @@ -130,7 +130,7 @@ async def run_script( result_lines = await shell_run_command( command=" ".join(cmd), return_all=True, - stream_level=10 # 使用 DEBUG 级别输出,实现实时输出效果 + stream_level=20 # 使用 INFO 级别输出,确保实时输出效果 ) # 将结果列表转换为字符串 @@ -244,6 +244,17 @@ def merge_params(*param_dicts: dict) -> dict: if __name__ == "__main__": import json + import asyncio + import logging + + # 配置日志,确保实时输出 + logging.basicConfig( + level=logging.INFO, + format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', + handlers=[ + logging.StreamHandler() # 确保日志输出到控制台 + ] + ) # 1. 解析命令行参数 args = parse_command_line_args() @@ -284,11 +295,11 @@ if __name__ == "__main__": print(" python backtest.py --flow-config flow_config.json") exit(1) - # 7. 执行 Flow - result = start( + # 7. 执行 Flow(使用 asyncio.run() 正确调用异步函数) + result = asyncio.run(start( script_url=script_url, shell_script=shell_script - ) + )) print("完成!") print(f"命令: {result['command']}")