feat: 失败二轮重试(休息60s后失败股整体重跑) + sync脚本补7个分叉副本硬链

This commit is contained in:
hmo
2026-07-22 08:26:32 +08:00
parent 04284e5187
commit fbad1938f1
2 changed files with 24 additions and 0 deletions
+19
View File
@@ -510,6 +510,7 @@ def main():
ok = 0
fail = 0
skip = 0
failed_codes = []
for i, code in enumerate(codes):
if has_llm_analysis(code) and not analysis_stale(code, force_today):
print(f" [{i+1}/{len(codes)}] \u23ed {code} 已有12维分析且未过期")
@@ -521,12 +522,30 @@ def main():
ok += 1
else:
fail += 1
failed_codes.append(code)
# 间隔8秒(pro model较重但gateway可承受;retry逻辑吸收瞬断)
if i < len(codes) - 1:
print(f" 等待8秒...", flush=True)
time.sleep(8)
# ── 失败二轮:主跑结束后休息 60s 让上游恢复,失败股整体重试一次 ──
# (凌晨上游空输出高发,二轮可救回大半;仍失败的留给下一轮调度)
if failed_codes:
print(f"\n{'='*50}")
print(f"失败二轮: {len(failed_codes)}只,休息60s后重试...")
time.sleep(60)
retry_ok = 0
for code in failed_codes:
print(f" [retry] {code} ", end="", flush=True)
if process_stock(code, force_today):
retry_ok += 1
ok += 1
fail -= 1
print(f" 等待8秒...", flush=True)
time.sleep(8)
print(f"失败二轮: {retry_ok}/{len(failed_codes)} 救回")
print(f"\n{'='*50}")
print(f"完成: {ok}成功, {fail}失败, {skip}跳过")
print(f"{'='*50}")
@@ -24,6 +24,11 @@ for lib in mofin_db.py mo_data.py; do
fi
done
# ── cron 脚本分叉副本(scripts/ 旧副本)→ 硬链到 deploy/profile-scripts canonical ──
for f in verify_reassess_pipeline.py batch_reassess.py stale_detector.py fix_gateway_port.py morning_health_check.py candidate_filter.py per_stock_reassess.py; do
[ -f "$SRC/$f" ] && ln -f "$SRC/$f" "$ROOT/scripts/$f" 2>/dev/null || true
done
echo "synced $count scripts (hardlink)"
mkdir -p /home/hmo/MoFin/gateway/logs
echo "$(date '+%F %T') synced $count scripts" >> /home/hmo/MoFin/gateway/logs/link_sync.log