Files
MoFin/archive/hermes-dead-tools-20260820/inv5.py
T
xxm c68f987653 chore(cleansweep): 代码大扫除——归档hermes 111个死工具+4个废弃scanner,收敛MoFin/scripts重复副本,删除根旧版mo_models
- archive/hermes-dead-tools-20260820/: hermes独有不在cron不被import的111个一次性排查/测试工具
- archive/hermes-dead-tools-20260820/: 4个废弃scanner(btd1_v3/market_scanner/market_thermometer已废弃/s2v2)
- archive/legacy-cleanup-20260820/: MoFin根2旧版(mo_models/technical_analysis)+/home/hmo/scripts无引用旧项目+MoFin/scripts重复prepare_report_data
- 删除MoFin根mo_models.py(根旧版,deploy/profile-scripts权威保留)
- 保留: mofin_db.py/mo_data.py硬链接(server.py多层sys.path需各目录访问同一inode,非冗余)
- fix_gateway.py保留(Gateway看门狗fix_gateway_port.py的活跃依赖,勿误删)
- 验证: cron所有脚本引用无缺失, key模块import正常
- hermes独有从116收敛到5核心(alert_logger/market_screener/prepare_report_data/self_todo_executor_v2/xmpp_zhiwei_bot)
2026-08-20 10:36:25 +08:00

60 lines
2.6 KiB
Python

import json, os, subprocess
from datetime import datetime
now = datetime.now()
print("=== 1. DATA FILES ===")
for f in ['multi_tf_cache.json', 'macro_context.json']:
p = f'/home/hmo/MoFin/data/{f}'
if os.path.exists(p):
mtime = datetime.fromtimestamp(os.path.getmtime(p))
h = (now - mtime).total_seconds() / 3600
print(f'{f}: {mtime} ({h:.0f}h ago)')
else:
print(f'{f}: MISSING')
pm = '/home/hmo/web-dashboard/data/market.json'
print(f'market.json: {"EXISTS" if os.path.exists(pm) else "MISSING"}')
print()
print("=== 2. CRON MISSING SCRIPTS in profile scripts dir ===")
d = json.load(open('/home/hmo/.hermes/profiles/position-analyst/cron/jobs.json'))
jobs = d if isinstance(d, list) else d.get('jobs', [])
sdir = '/home/hmo/.hermes/profiles/position-analyst/scripts'
exist = set(os.listdir(sdir))
for j in jobs:
s = j.get('script', '')
if s and s not in exist and j.get('no_agent'):
f = subprocess.run(['find', '/home/hmo/MoFin', '-name', s, '-not', '-path', '*/venv/*'],
capture_output=True, text=True, timeout=15)
locs = [l for l in f.stdout.splitlines() if l.strip()]
print(f"MISSING: {s} (job: {j.get('name')}) -> {locs[:2] if locs else 'NOT FOUND'}")
print()
print("=== 3. suggestions table ===")
r = subprocess.run(['grep', '-rn', 'suggestions', '/home/hmo/MoFin/deploy/profile-scripts/', '--include=*.py'],
capture_output=True, text=True, timeout=10)
for l in r.stdout.splitlines():
if 'suggestions' in l.lower():
print(l.strip())
# Check if any cron references it
r2 = subprocess.run(['python3', '-c', '''
import json
d = json.load(open("/home/hmo/.hermes/profiles/position-analyst/cron/jobs.json"))
jobs = d if isinstance(d, list) else d.get("jobs", [])
for j in jobs:
if "suggest" in str(j):
print(j.get("name",""), j.get("script",""), j.get("prompt","")[:100])
'''], capture_output=True, text=True, timeout=5)
print(r2.stdout)
print()
print("=== 4. price_monitor newspaper ===")
r = subprocess.run(['grep', '-n', 'newspaper', '/home/hmo/MoFin/deploy/profile-scripts/price_monitor.py'], capture_output=True, text=True, timeout=5)
print(r.stdout[-500:] if len(r.stdout) > 500 else r.stdout)
print()
print("=== 5. Which crons generate multi_tf_cache / macro_context ===")
for j in jobs:
if j.get('name') and ('多周期' in j.get('name','') or '宏观' in j.get('name','') or 'multi' in j.get('name','').lower() or 'market' in j.get('name','').lower()):
print(f"{j.get('name')}: script={j.get('script','?')} status={j.get('last_status','?')} last_run={j.get('last_run_at','?')} err={str(j.get('last_error',''))[:80]}")