bench: a run that finds no server names the address it asked (#5369, port part)

`strata bench run --profile X` said "no Strata server answers at that
address" and never named it. The reporter's profile, made from setup's
installed run config, asked 8080 (setup's port; a launch's --port lives in
the launch's own config and its profile launch-<preset>), where another
program listened. Now: "No Strata server answers at http://127.0.0.1:8080
(this profile's address). If you started the model with strata launch, use
its profile launch-<preset> (see strata profile list), or set the port:
strata profile set X port=N." Without a profile only the address is named.
The installed run config keeping setup's port is unchanged on purpose.

Tests: tests/terminal/test_bench_no_server_address.py; with
test_bench_standard 216 passed on Boston (with the #5400 tests).
This commit is contained in:
Niko1221 committed 2026-11-16 17:53:39 +01:00
1 parent bfa6315d78
commit d68fe3205c
3 files changed
+54 -3

No files matched your search

+10 -2
View File
@@ -823,11 +823,19 @@ def slug(text: str, limit: int = 40) -> str:
return re.sub(r"[^a-z0-9]+", "-", cleaned.lower()).strip("-")[:limit].strip("-") or "unknown"
def no_server_text(address: str, profile: str | None = None) -> str:
"""#5369: the address that did not answer, and for a profile the way to the one that serves (a launch's own profile, or its port)."""
if not profile:
return f"No Strata server answers at {address}."
return (f"No Strata server answers at {address} (this profile's address). If you started the model with strata launch, use its profile "
f"launch-<preset> (see strata profile list), or set the port: strata profile set {profile} port=N.")
def run(target: Target, out: Path | None, *, out_root: Path | None = None, optional_concurrency: bool = False,
corpus: Corpus | None = None, declared: dict | None = None, plan: dict | None = None,
engine_log: Path | None = None, engine_run_log: tuple[Path | None, int] | None = None, command: str = "strata bench run --suite standard-v1",
log=lambda message: None, timeout_s: float = REQUEST_TIMEOUT_S, started_engine: bool = False,
hash_model: bool = True) -> tuple[dict, Path]:
hash_model: bool = True, profile: str | None = None) -> tuple[dict, Path]:
"""Run the protocol against `target` and write the report into the new directory `out` (or a new folder named
<date>-standard-<gpu>-<run id> under `out_root`). -> (the result, the folder)."""
declared = {"track": "custom", "track_notes": "no notes given by the operator", **(declared or {})}
@@ -840,7 +848,7 @@ def run(target: Target, out: Path | None, *, out_root: Path | None = None, optio
raise ProfileError("benchmark needs an output directory", 2)
health = target.get("/health", timeout=10)
if not health or health.get("service") != "strata":
raise ProfileError("no Strata server answers at that address", 5)
raise ProfileError(no_server_text(target.root, profile), 5)
if health.get("loaded") is not True:
raise ProfileError("the server has no model loaded; the benchmark needs a loaded model", 5)
props = target.get("/props", timeout=15)
+1 -1
View File
@@ -1322,7 +1322,7 @@ def _bench_standard(a: argparse.Namespace, machine: bool) -> int:
doc, out_dir = bench_standard.run(target, out, out_root=out_root, optional_concurrency=a.optional_concurrency,
declared=declared, plan=plan, engine_log=engine_log, command=command, log=log,
engine_run_log=(run_log, log_start) if proc is not None else None,
started_engine=proc is not None, hash_model=not a.skip_model_hash)
started_engine=proc is not None, hash_model=not a.skip_model_hash, profile=a.profile)
finally:
stop_problem = bench_standard.stop_engine(proc)
if not isinstance(stop_problem, str):
@@ -0,0 +1,43 @@
"""#5369 (port part): `strata bench run` that finds no server names the address it asked, and for a profile the way to the one that serves: a model
started with strata launch has its own profile (launch-<preset>, with the launch's port), or the profile's port can be set. (The profile made from
setup's installed run config keeps setup's port 8080 on purpose: a launch's --port lives in its own launch config.)"""
from __future__ import annotations
import tempfile
import unittest
from pathlib import Path
from strata_cli import bench_standard as B
from strata_control.profiles import ProfileError
class Silent:
root = "http://127.0.0.1:8080"
def get(self, path, timeout=10):
return None
class NoServer(unittest.TestCase):
def test_the_words(self):
self.assertEqual(B.no_server_text("http://127.0.0.1:8080"), "No Strata server answers at http://127.0.0.1:8080.")
self.assertEqual(B.no_server_text("http://127.0.0.1:8080", "bench1"),
"No Strata server answers at http://127.0.0.1:8080 (this profile's address). If you started the model with strata launch, "
"use its profile launch-<preset> (see strata profile list), or set the port: strata profile set bench1 port=N.")
def test_the_run_refuses_with_the_address(self):
with tempfile.TemporaryDirectory() as tmp:
with self.assertRaises(ProfileError) as cm:
B.run(Silent(), Path(tmp) / "out", profile="bench1")
self.assertEqual(cm.exception.exit_code, 5)
self.assertIn("http://127.0.0.1:8080 (this profile's address)", str(cm.exception))
self.assertIn("strata profile set bench1 port=N", str(cm.exception))
def test_the_command_passes_the_profile(self):
src = (Path(__file__).resolve().parents[2] / "strata_cli" / "cli.py").read_text(encoding="utf-8")
self.assertIn("hash_model=not a.skip_model_hash, profile=a.profile)", src)
if __name__ == "__main__":
unittest.main()