From 3330931f304bceabc70a7247204eff72d269834d Mon Sep 17 00:00:00 2001 From: Corback Date: Tue, 16 Jun 2026 10:54:02 +0000 Subject: [PATCH] unify: dashboard now lives in repo, docker-compose moved to root, credentials in .env --- .env.example | 8 + .gitignore | 1 + dashboard/app.py | 1373 ++++++++++++++++++++++++++------- docker-compose.yml | 36 + src/config/crash_results.json | 54 ++ tools/capacity_test.py | 343 ++++++++ 6 files changed, 1530 insertions(+), 285 deletions(-) create mode 100644 .env.example create mode 100644 docker-compose.yml create mode 100644 src/config/crash_results.json create mode 100644 tools/capacity_test.py diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..70a0e79 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +DB_HOST=127.0.0.1 +DB_PORT=15432 +DB_NAME=fallout +DB_USER=fallout +DB_PASS= +OLLAMA_URL=http://host.docker.internal:11434 +MODEL_MJ=qwen2.5:14b +MODEL_PNJ=qwen2.5:7b diff --git a/.gitignore b/.gitignore index df60c42..4601cd9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ __pycache__/ .DS_Store Thumbs.db INFRA_PRIVATE.md +.env diff --git a/dashboard/app.py b/dashboard/app.py index f8f24e0..3dca479 100644 --- a/dashboard/app.py +++ b/dashboard/app.py @@ -1,16 +1,65 @@ """ -VAULTCOM — Fallout: Venice of Wasteland -Dashboard simulation. Schéma DB actuel (migration_003). -Onglets: Simulation (par session) | Paramètres (config + restart) +PipBoy — Fallout: Venice of Wasteland +Dashboard unifié : Simulation | Outils | Lore enrichment | Paramètres +(anciennement VAULTCOM) """ -import os, json, subprocess +import os, json, subprocess, threading, time import psycopg2 import psycopg2.extras from flask import Flask, render_template_string, jsonify, request, redirect, url_for app = Flask(__name__) +# --------------------------------------------------------------------------- +# Stress test — état global (un seul test à la fois) +# --------------------------------------------------------------------------- +_stress_state = { + "running": False, + "started_at": None, + "mode": None, + "rounds": None, + "pnj_count": None, + "output": [], # lignes de stdout + "returncode": None, + "error": None, +} +_stress_lock = threading.Lock() + +def _run_stress_bg(mode: str, rounds: int, pnj_count: int): + global _stress_state + ollama_url = os.getenv("OLLAMA_URL", "http://host.docker.internal:11434") + model_mj = os.getenv("MODEL_MJ", "qwen2.5:14b") + model_pnj = os.getenv("MODEL_PNJ", "qwen2.5:7b") + results_path = os.path.join(SIM_CONFIGS_DIR, "crash_results.json") + + cmd = [ + "python3", "/app/tools/llm_crash_test.py", + "--mode", mode, + "--rounds", str(rounds), + "--pnj-count", str(pnj_count), + ] + env = {**os.environ, + "OLLAMA_URL": ollama_url, + "MODEL_MJ": model_mj, + "MODEL_PNJ": model_pnj, + "CRASH_RESULTS_PATH": results_path, + "PYTHONUNBUFFERED": "1"} + try: + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + text=True, env=env) + for line in proc.stdout: + with _stress_lock: + _stress_state["output"].append(line.rstrip()) + proc.wait() + with _stress_lock: + _stress_state["returncode"] = proc.returncode + _stress_state["running"] = False + except Exception as e: + with _stress_lock: + _stress_state["error"] = str(e) + _stress_state["running"] = False + DB_HOST = os.getenv("DB_HOST", "localhost") DB_PORT = int(os.getenv("DB_PORT", 5432)) DB_NAME = os.getenv("DB_NAME", "fallout") @@ -80,172 +129,573 @@ TEMPLATE = r""" -VAULTCOM — Fallout: Venice of Wasteland +PipBoy — Fallout: Venice of Wasteland -

⚡ VAULTCOM — VENICE OF WASTELAND ⚡

- -