feat: auto-run pipeline on startup
This commit is contained in:
17
main.py
17
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user