Open-source inference server and production cluster for all the models your agent needs.
Python bgecolbertdata-pipelinedeep-learningembeddingsinferenceinference-serverinformation-retrievalllmmlmlopsnatural-language-processingnlppythonrerankingretrievalretrieval-augmented-generationsemantic-searchspladevector-search
fix(benchmarks): retain cleanup evidence on inspection errors
svonava9fc2ce528e70
diff --git a/tools/benchmarks/model_recovery/probe.py b/tools/benchmarks/model_recovery/probe.pyindex 2376f9e44..7e5799d98 100644--- a/tools/benchmarks/model_recovery/probe.py+++ b/tools/benchmarks/model_recovery/probe.py@@ -366,7 +366,7 @@ async def run(args: argparse.Namespace, evidence: Evidence) -> bool:evidence.emit("before_shutdown",tracked_child_pids=sorted(pid for pid, _ in child_identities),- inspection_errors=inspection_errors,+ inspection_errors=list(inspection_errors),)server.should_exit = Truetry:@@ -379,11 +379,14 @@ async def run(args: argparse.Namespace, evidence: Evidence) -> bool:alive.append(pid)except psutil.NoSuchProcess:pass+ except psutil.Error as exc:+ inspection_errors.append({"stage": "liveness", "pid": pid, "error_type": type(exc).__name__})cleanup_ok = not inspection_errors and not alive and (registry is None or not registry.loaded_model_names)evidence.emit("cleanup",okay=cleanup_ok,owned_children_alive=alive,+ inspection_errors=list(inspection_errors),state=snapshot(registry) if registry is not None else None,)except Exception as exc: # noqa: BLE001 - Keep cleanup failure evidence even when shutdown raises.diff --git a/tools/benchmarks/model_recovery/tests/test_probe.py b/tools/benchmarks/model_recovery/tests/test_probe.pyindex a1bef808e..ef4db36a8 100644--- a/tools/benchmarks/model_recovery/tests/test_probe.py+++ b/tools/benchmarks/model_recovery/tests/test_probe.py@@ -13,9 +13,12 @@ from tools.benchmarks.model_recovery import probe@pytest.mark.asyncio[email protected]("failure_stage", ["enumerate", "identity"])+ ("failure_stage", "verified_alive"),+ [("enumerate", False), ("identity", False), ("liveness", False), ("liveness", True)],+)async def test_process_inspection_failure_does_not_skip_shutdown_or_summary(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch, failure_stage: str+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, failure_stage: str, verified_alive: bool) -> None:monkeypatch.setattr(probe.os, "environ", probe.os.environ.copy())registry = SimpleNamespace(_loaded={}, loaded_model_names=[])@@ -35,20 +38,38 @@ async def test_process_inspection_failure_does_not_skip_shutdown_or_summary(server = Server()monkeypatch.setattr(probe.uvicorn, "Server", lambda _config: server)+ inspected_pids: set[int] = set()class Child:- pid = 12345+ def __init__(self, pid: int) -> None:+ self.pid = piddef create_time(self) -> float:- raise psutil.AccessDenied(self.pid)+ if self.pid == 12345 and (+ failure_stage == "identity" or (failure_stage == "liveness" and server.shutdown_complete)+ ):+ raise psutil.AccessDenied(self.pid)+ return float(self.pid)++ def is_running(self) -> bool:+ return verified_alive and self.pid == 12346++ def status(self) -> str:+ return psutil.STATUS_RUNNINGclass Parent:def children(self, **_kwargs: object) -> list[Child]:if failure_stage == "enumerate":raise psutil.AccessDenied- return [Child()]+ return [Child(12345), Child(12346)]++ def process(pid: int) -> Parent | Child:+ if pid == probe.os.getpid():+ return Parent()+ inspected_pids.add(pid)+ return Child(pid)- monkeypatch.setattr(probe.psutil, "Process", lambda _pid: Parent())+ monkeypatch.setattr(probe.psutil, "Process", process)args = argparse.Namespace(smoke=True, deadline_s=10, output=tmp_path / "evidence")evidence = probe.Evidence(args.output)@@ -59,10 +80,19 @@ async def test_process_inspection_failure_does_not_skip_shutdown_or_summary(assert server.shutdown_completeassert any(row["event"] == "protocol_failed" for row in evidence.rows)inspection = next(row for row in evidence.rows if row["event"] == "before_shutdown")- assert inspection["inspection_errors"][0]["stage"] == failure_stage- assert inspection["inspection_errors"][0]["error_type"] == "AccessDenied"+ if failure_stage == "liveness":+ assert inspection["inspection_errors"] == []+ assert inspected_pids == {12345, 12346}+ else:+ assert inspection["inspection_errors"][0]["stage"] == failure_stagecleanup = next(row for row in evidence.rows if row["event"] == "cleanup")assert cleanup["okay"] is False+ assert cleanup["owned_children_alive"] == ([12346] if verified_alive else [])+ assert cleanup["inspection_errors"][0]["stage"] == failure_stage+ assert cleanup["inspection_errors"][0]["error_type"] == "AccessDenied"+ persisted = [json.loads(line) for line in (args.output / "events.jsonl").read_text().splitlines()]+ assert next(row for row in persisted if row["event"] == "before_shutdown") == inspection+ assert next(row for row in persisted if row["event"] == "cleanup") == cleanupsummary = json.loads((args.output / "summary.json").read_text())assert summary["passed"] is Falseassert summary["cleanup_ok"] is False