"""DaisyChain dashboard (CLI: `daisychain-dashboard`). Tailwind-styled page with a readiness banner, P2P connectivity scan, pooled resource + capacity plan, and live training status. Config via DAISY_NODES_FILE. Serves on :8080.""" import json import os from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer try: from daisychain.dashboard.scanner import scan_cluster except Exception: from scanner import scan_cluster # running from the folder directly NODES_FILE = os.environ.get("DAISY_NODES_FILE", "config/nodes.example.json") PORT = int(os.environ.get("DAISY_DASH_PORT", "8080")) EXPECTED_WORLD = os.environ.get("DAISY_EXPECTED_WORLD") BASE_BATCH = int(os.environ.get("DAISY_BASE_BATCH", "32")) def load_nodes(): with open(NODES_FILE) as f: return json.load(f) def _chip(ok, yes="OK", no="DOWN"): cls = ("bg-emerald-500/20 text-emerald-600 dark:text-emerald-400" if ok else "bg-rose-500/20 text-rose-600 dark:text-rose-400") return f'{yes if ok else no}' def render(d): ready = d["ready"] banner = ("bg-emerald-500", "✓ CLUSTER READY — all nodes connected") if ready \ else ("bg-rose-500", f"✗ NOT READY — {d['reachable']}/{d['total']} nodes reachable") rows = "" for n in d["nodes"]: lat = f'{n["latency_ms"]} ms' if n["latency_ms"] is not None else "—" res = n.get("resources") or {} dev = res.get("device", "—") gpu = (res.get("gpu") or {}).get("name", "") devlabel = f"{dev}" + (f" ({gpu})" if gpu else "") rows += f"""
{loss:.5f} cluster-avg loss
""" else: train = 'No active run detected (waiting for rank 0 status)…
' return f"""Old Hardware Training Pipeline · scanned {d['scanned_at']}
Nodes
{d['reachable']}/{d['total']}
Total cores
{plan['total_cores']}
Total RAM
{tot_ram}
| Node | Host | Agent | Device | Latency |
|---|
| Node | Device | RAM | Capacity | Weight | Batch |
|---|