Files
MoFin/archive/20260722-scripts-cleanup/investigate_5_issues.py
T

47 lines
1.8 KiB
Python

import json, os
# 1. Check data pipeline stagnation
print("=== DATA FILE AGES ===")
for f in ['multi_tf_cache.json', 'macro_context.json', 'market.json']:
p = f'/home/hmo/MoFin/data/{f}'
if os.path.exists(p):
sec = (os.path.getmtime(p))
from datetime import datetime
print(f' {f}: {datetime.fromtimestamp(sec)} ({int((os.path.getmtime(p))/3600)}h ago)')
else:
print(f' {f}: MISSING')
# 2. Cron scripts missing from profile scripts dir
print()
print("=== MISSING CRON SCRIPTS ===")
d = json.load(open('/home/hmo/.hermes/profiles/position-analyst/cron/jobs.json'))
jobs = d if isinstance(d, list) else d.get('jobs', [])
scripts_dir = '/home/hmo/.hermes/profiles/position-analyst/scripts'
existing = set(os.listdir(scripts_dir))
missing = []
for j in jobs:
s = j.get('script', '')
if s and s not in existing and j.get('no_agent'):
missing.append((j.get('name'), s))
print(f' MISSING: {s} (job: {j.get(\"name\",\"?\")})')
if not missing:
print(' (none missing)')
# 3. Find source locations for missing scripts
print()
print("=== FIND MISSING SCRIPTS IN MoFin ===")
for name, script in missing:
import subprocess
r = subprocess.run(['find', '/home/hmo/MoFin', '-name', script, '-not', '-path', '*/venv/*'],
capture_output=True, text=True, timeout=15)
found = [l for l in r.stdout.splitlines() if l.strip()]
print(f' {script}: {found if found else "NOT FOUND"}')
# 4. market.json generator
print()
print("=== market.json GENERATOR ===")
r = subprocess.run(['grep', '-rn', "'market.json'", '/home/hmo/MoFin/deploy/profile-scripts/', '/home/hmo/MoFin/scripts/'],
capture_output=True, text=True, timeout=10)
for l in r.stdout.splitlines():
if 'market.json' in l:
print(f' {l}')