feat: auto-run pipeline on startup

This commit is contained in:
z3st
2026-07-21 19:09:41 +08:00
parent 2955a57e2e
commit 7313f8da67

17
main.py
View File

@@ -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()