From 9d3cab23066793b63d0860eb2369c0b393e2170b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Tue, 21 Jul 2026 12:03:21 +0800 Subject: [PATCH] =?UTF-8?q?clean:=20=E7=A7=BB=E9=99=A4=E7=9B=98=E4=B8=AD?= =?UTF-8?q?=E8=87=AA=E6=A3=80/=E6=97=A9=E4=B8=8A=E5=81=A5=E5=BA=B7?= =?UTF-8?q?=E6=A3=80=E6=9F=A5/=E7=B3=BB=E7=BB=9F=E5=AE=A1=E8=AE=A1?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=B0=8F=E6=9E=9C=E6=AE=8B=E7=95=99=E5=BC=95?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile-scripts/morning_health_check.py | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/deploy/profile-scripts/morning_health_check.py b/deploy/profile-scripts/morning_health_check.py index 89ca01f7..c17fb8ef 100644 --- a/deploy/profile-scripts/morning_health_check.py +++ b/deploy/profile-scripts/morning_health_check.py @@ -42,15 +42,12 @@ HERMES_CRON_DIR = Path("/home/hmo/.hermes/profiles/position-analyst/cron") def derive_fix_action(detail, msg): """根据issue信息推导可执行的修复命令""" - # 小果扫描 error → 验证脚本是否存在 - if "xiaoguo_scanner" in msg or "小果扫描" in msg: - return f"ls -la /home/hmo/.hermes/profiles/position-analyst/scripts/xiaoguo_scanner.py 2>&1 && echo 'ok'" # system-audit error → 验证拷贝 if "system_audit" in msg or "系统审计" in msg: return f"ls -la /home/hmo/.hermes/profiles/position-analyst/scripts/system_audit.py 2>&1" # cron errors(last_status=error)→ 验证文件存在,等下次cron运行自动恢复 - if "cron" in msg.lower() and "error" in msg.lower() and ("小果" in msg or "系统审计" in msg): - return f"ls -la /home/hmo/.hermes/profiles/position-analyst/scripts/xiaoguo_scanner.py /home/hmo/.hermes/profiles/position-analyst/scripts/system_audit.py 2>&1" + if "cron" in msg.lower() and "error" in msg.lower() and "系统审计" in msg: + return f"ls -la /home/hmo/.hermes/profiles/position-analyst/scripts/system_audit.py 2>&1" # 港股汇率 → 刷新 if "港股汇率" in msg: return f"cd {BASE} && python3 hk_rate.py 2>&1" @@ -60,9 +57,9 @@ def derive_fix_action(detail, msg): # delivery目标缺失 → 改为local if "deliver" in msg.lower() or "delivery" in msg.lower(): return f"cd {BASE} && echo '需手动设置: cronjob action=update deliver=local'" - # 小果→知微桥不通 + # 小果→知微桥不通(小果已归档,不再自动修复) if "信号桥" in msg: - return f"cd {BASE} && python3 scripts/xiaoguo_signal_consumer.py 2>&1" + return None return None @@ -319,8 +316,6 @@ def check_db_table_count(table, field, value, op="today", threshold=0): cols = [r[1] for r in cur.execute(f"PRAGMA table_info({table})").fetchall()] if "processed" in cols: sql = f"SELECT COUNT(*) FROM {table} WHERE (processed = 0 OR processed IS NULL)" - elif "source" in cols: - sql = f"SELECT COUNT(*) FROM {table} WHERE source LIKE '%xiaoguo%'" else: sql = f"SELECT COUNT(*) FROM {table}" cur.execute(sql) @@ -400,7 +395,6 @@ def check_cron_paused(): """检查不应暂停的cron是否被误暂停""" should_run = [ ("3a9fb3300a6a", "价格监控"), - ("0851c7838ca3", "小果扫描"), ("e13323928f3a", "自选提醒"), ("b809fcabfa5b", "分支评估"), ] @@ -604,10 +598,9 @@ def run_check(item): elif check_spec == "meta:checklist_completeness": ok, detail = check_meta_checklist_completeness() elif check_spec == "pipeline:xiaoguo_signal_flow": - today_xiaoguo, d1 = check_db_table_count("signal_news", "created_at", None, "today", 0) - unproc, d2 = check_db_table_count("signal_news", None, None, "unprocessed", 30) - ok = today_xiaoguo or unproc - detail = f"today_xiaoguo={d1}, unprocessed={d2}" + # 小果已归档,该管道不再检查 + ok = True + detail = "skipped (xiaoguo archived)" elif check_spec == "pipeline:registry_audit": ok = True gaps = []