Files
MoFin/scripts/prune_branches.py
T

22 lines
626 B
Python
Executable File
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.
#!/usr/bin/env python3
"""
prune_branches.py — 每周六凌晨6点执行
低效分支剪枝:
- 触发≥5次且成功率<30% → 剪枝归档
- 输出报告(stdout → cron delivery
"""
import sys, json
sys.path.insert(0, '/home/hmo/MoFin')
from strategy_tree import prune_low_performance_branches
result = prune_low_performance_branches(min_triggers=5, min_success_rate=0.3)
if result:
print(f"[分支剪枝] 已剪枝 {len(result)} 条低效分支:")
for item in result:
print(f"{item}")
print("[分支剪枝] 剪枝完成")
else:
print("[分支剪枝] 无低效分支需剪枝")