Files
weval-l99/weval-finisher.py
2026-04-13 12:43:21 +02:00

61 lines
2.5 KiB
Python
Executable File

#!/usr/bin/env python3
"""WEVAL Autonomous Finisher — runs all remaining tasks"""
import os, json, subprocess, time, urllib.request
LOG = "/var/log/weval-finisher.log"
def log(msg):
ts = time.strftime("%Y-%m-%d %H:%M:%S")
with open(LOG, "a") as f: f.write(f"{ts} {msg}\n")
print(f"[{ts}] {msg}")
# 1. Qdrant re-populate
log("=== QDRANT SYNC ===")
r = subprocess.run(["python3","/opt/weval-l99/qdrant-skill-sync.py"], capture_output=True, text=True, timeout=60)
log(f"Qdrant sync: {r.stdout[-100:]}" if r.stdout else f"Qdrant error: {r.stderr[-100:]}")
# 2. Run all L99 tests
for test in ["l99-functional-test.py","l99-security-scan.py","l99-visual-test.py"]:
path = f"/opt/weval-l99/{test}"
if os.path.exists(path):
log(f"Running {test}...")
r = subprocess.run(["python3",path], capture_output=True, text=True, timeout=120)
log(f"{test}: {r.stdout[-80:]}" if r.stdout else f"{test} error")
# 3. Run health monitor
log("=== HEALTH MONITOR ===")
r = subprocess.run(["python3","/opt/weval-l99/health-monitor.py"], capture_output=True, text=True, timeout=30)
log(f"Health: {r.stdout[-80:]}" if r.stdout else "Health error")
# 4. Run wiki mega scan
log("=== WIKI SCAN ===")
r = subprocess.run(["python3","/opt/weval-l99/wiki-mega-scan.py"], capture_output=True, text=True, timeout=60)
log(f"Wiki: {r.stdout[-80:]}" if r.stdout else "Wiki error")
# 5. Run enterprise-model-sync
log("=== ENTERPRISE SYNC ===")
r = subprocess.run(["python3","/opt/weval-l99/enterprise-model-sync.py"], capture_output=True, text=True, timeout=30)
log(f"Enterprise: {r.stdout[-80:]}" if r.stdout else "Enterprise error")
# 6. Run OSS cache gen
log("=== OSS CACHE ===")
r = subprocess.run(["python3","/tmp/oss-gen.py"], capture_output=True, text=True, timeout=30)
log(f"OSS: {r.stdout[-80:]}" if r.stdout else "OSS error")
# 7. Run registry update
log("=== REGISTRY ===")
r = subprocess.run(["python3","/opt/weval-l99/registry-master.py"], capture_output=True, text=True, timeout=30)
log(f"Registry: {r.stdout[-80:]}" if r.stdout else "Registry error")
# 8. Git commit + push
log("=== GIT ===")
os.chdir("/var/www/html")
subprocess.run(["git","add","-A"])
r = subprocess.run(["git","commit","-m","AUTONOMOUS FINISHER: all tasks executed"], capture_output=True, text=True)
log(f"Git: {r.stdout[-50:]}")
r = subprocess.run(["git","push","github","main"], capture_output=True, text=True, timeout=30)
log(f"Push: {r.stdout[-50:]}")
# 9. Notify Mattermost
log("=== DONE ===")
log("All autonomous tasks complete!")