Files
MoFin/deploy/profile-scripts/evolution_daily.py
T

38 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""evolution_daily.py — 策略进化机制 cron 入口(每周六 22:00hermes cron
放在 deploy/profile-scripts(硬链接进 cron scripts 目录),
内部串行调用:
1. evolution/evolution_engine.py — 进化引擎(退化检测+假设归纳+变体验证+推送,含单例守卫)
2. evolution/precompute_evolution.py — 进化中心预计算(假设归纳/B组/资格 → evolution_center.json,供研究Tab展示)
设计依据:docs/decisions/2026-08-15-策略自我进化闭环重构.md + 2026-08-16 老莫自我进化两方向
"""
import subprocess, sys, os
REPO = "/home/hmo/MoFin"
ENGINE = f"{REPO}/evolution/evolution_engine.py"
PRECOMPUTE = f"{REPO}/evolution/precompute_evolution.py"
PY = f"{REPO}/venv/bin/python"
def main():
# 1. 进化引擎(退化→假设→验证→推送)
if os.path.exists(ENGINE):
r1 = subprocess.run([PY, ENGINE], cwd=REPO, capture_output=False, timeout=3600)
else:
print(f"evolution_engine.py 不存在: {ENGINE}", flush=True)
r1 = None
# 2. 进化中心预计算(研究Tab展示数据)
if os.path.exists(PRECOMPUTE):
r2 = subprocess.run([PY, PRECOMPUTE], cwd=REPO, capture_output=False, timeout=3600)
print("进化中心预计算完成", flush=True)
else:
print(f"precompute_evolution.py 不存在: {PRECOMPUTE}", flush=True)
r2 = None
sys.exit((r1.returncode if r1 else 1) or (r2.returncode if r2 else 0))
if __name__ == "__main__":
main()