From 7313f8da670f4de07159ce9fc7c0ffa5d41eca95 Mon Sep 17 00:00:00 2001 From: z3st Date: Tue, 21 Jul 2026 19:09:41 +0800 Subject: [PATCH] feat: auto-run pipeline on startup --- main.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/main.py b/main.py index c21f2cb..a8c70cf 100644 --- a/main.py +++ b/main.py @@ -570,6 +570,23 @@ def main(): log(f"STRATEGY_ID: {STRATEGY_ID}") log(f"GPU: {', '.join(GPU_CONFIGS.keys())}") + # 启动后自动执行一次提交流程 + def _auto_run(): + time.sleep(3) # 等 HTTP 服务就绪 + log("自动触发提交流程...") + try: + state['running'] = True + state['last_run'] = datetime.now().isoformat() + count = run_pipeline(submit_limit=30) + state['last_result'] = {'submitted': count, 'success': True} + except Exception as e: + log(f"流程异常: {traceback.format_exc()}") + state['last_result'] = {'error': str(e), 'success': False} + finally: + state['running'] = False + + threading.Thread(target=_auto_run, daemon=True).start() + while not shutdown_requested: server.handle_request()