Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

tests: dashboard tests wait for HITS and PROF before reading them

JustVugg0404abaa3ce3
diff --git a/c/tests/test_dsv41_dashboard.py b/c/tests/test_dsv41_dashboard.py
index 76c9a405..50a11ef8 100644
--- a/c/tests/test_dsv41_dashboard.py
+++ b/c/tests/test_dsv41_dashboard.py
@@ -34,6 +34,18 @@ def get_json(url, timeout=10):
return json.load(response)
+def get_settled(url, limit_s=30):
+ """HITS and PROF follow DONE on the engine's stdout, so the reply can reach the
+ client before the gateway has read them. Wait for `seq` to say they arrived; past
+ the limit return what is there and let the assertions name what is missing."""
+ deadline = time.time() + limit_s
+ while True:
+ payload = get_json(url)
+ if payload.get("seq", 0) >= 1 or time.time() > deadline:
+ return payload
+ time.sleep(0.05)
+
+
@unittest.skipUnless(FIXTURE.name and (FIXTURE / "config.json").is_file()
and (FIXTURE / "tokenizer.json").is_file(),
"COLI_DSV41_FIXTURE not set to a V4.1 container with a tokenizer")
@@ -68,8 +80,8 @@ class Dsv41DashboardTest(unittest.TestCase):
data=body, headers={"Content-Type": "application/json"})
with urllib.request.urlopen(request, timeout=300) as response:
cls.completion = json.load(response)
- cls.experts = get_json(f"http://127.0.0.1:{cls.port}/experts")
- cls.profile = get_json(f"http://127.0.0.1:{cls.port}/profile")
+ cls.experts = get_settled(f"http://127.0.0.1:{cls.port}/experts")
+ cls.profile = get_settled(f"http://127.0.0.1:{cls.port}/profile")
cls.config = json.loads((FIXTURE / "config.json").read_text())
@classmethod
diff --git a/c/tests/test_glm53_dashboard.py b/c/tests/test_glm53_dashboard.py
index d0646201..defc8286 100644
--- a/c/tests/test_glm53_dashboard.py
+++ b/c/tests/test_glm53_dashboard.py
@@ -35,6 +35,18 @@ def get_json(url, timeout=10):
return json.load(r)
+def get_settled(url, limit_s=30):
+ """HITS and PROF follow DONE on the engine's stdout, so the reply can reach the
+ client before the gateway has read them. Wait for `seq` to say they arrived; past
+ the limit return what is there and let the assertions name what is missing."""
+ deadline = time.time() + limit_s
+ while True:
+ payload = get_json(url)
+ if payload.get("seq", 0) >= 1 or time.time() > deadline:
+ return payload
+ time.sleep(0.05)
+
+
@unittest.skipUnless(FIXTURE and Path(FIXTURE, "config.json").is_file(),
"COLI_GLM53_FIXTURE not set to a GLM-5.3-Flash container")
@unittest.skipUnless((HERE / "glm53").exists() or (HERE / "glm53.exe").exists(),
@@ -64,8 +76,8 @@ class Glm53DashboardTest(unittest.TestCase):
headers={"Content-Type": "application/json"})
with urllib.request.urlopen(req, timeout=300) as r:
cls.completion = json.load(r)
- cls.experts = get_json(f"http://127.0.0.1:{cls.port}/experts")
- cls.profile = get_json(f"http://127.0.0.1:{cls.port}/profile")
+ cls.experts = get_settled(f"http://127.0.0.1:{cls.port}/experts")
+ cls.profile = get_settled(f"http://127.0.0.1:{cls.port}/profile")
@classmethod
def tearDownClass(cls):
diff --git a/c/tests/test_qwen36_dashboard.py b/c/tests/test_qwen36_dashboard.py
index f681b433..13b98052 100644
--- a/c/tests/test_qwen36_dashboard.py
+++ b/c/tests/test_qwen36_dashboard.py
@@ -37,6 +37,18 @@ def get_json(url, timeout=10):
return json.load(r)
+def get_settled(url, limit_s=30):
+ """HITS and PROF follow DONE on the engine's stdout, so the reply can reach the
+ client before the gateway has read them. Wait for `seq` to say they arrived; past
+ the limit return what is there and let the assertions name what is missing."""
+ deadline = time.time() + limit_s
+ while True:
+ payload = get_json(url)
+ if payload.get("seq", 0) >= 1 or time.time() > deadline:
+ return payload
+ time.sleep(0.05)
+
+
@unittest.skipUnless(FIXTURE and Path(FIXTURE, "config.json").is_file()
and Path(FIXTURE, "tokenizer.json").is_file(),
"COLI_QWEN36_FIXTURE not set to a Qwen3.6 container with a tokenizer")
@@ -67,8 +79,8 @@ class Qwen36DashboardTest(unittest.TestCase):
headers={"Content-Type": "application/json"})
with urllib.request.urlopen(req, timeout=300) as r:
cls.completion = json.load(r)
- cls.experts = get_json(f"http://127.0.0.1:{cls.port}/experts")
- cls.profile = get_json(f"http://127.0.0.1:{cls.port}/profile")
+ cls.experts = get_settled(f"http://127.0.0.1:{cls.port}/experts")
+ cls.profile = get_settled(f"http://127.0.0.1:{cls.port}/profile")
@classmethod
def tearDownClass(cls):