routing tests, launch.configs, redirect, stats and route statistics
This commit is contained in:
@@ -99,6 +99,21 @@ def test_route_stats_ewma_averages_samples():
|
||||
# ---- choose_route --------------------------------------------------------
|
||||
|
||||
|
||||
def test_route_stats_persist_historical_hop_latency_across_restart(tmp_path):
|
||||
db_path = str(tmp_path / "routing-stats.sqlite")
|
||||
signature = "m|gpu[0-11]->cpu[12-23]"
|
||||
store = RouteStatsStore(RoutingConfig(stats_half_life_seconds=1e9), db_path=db_path)
|
||||
store.record_sample("m", signature, tokens=100, elapsed_seconds=2.0, now=100.0)
|
||||
store.save_to_db()
|
||||
|
||||
restored = RouteStatsStore(RoutingConfig(stats_half_life_seconds=1e9), db_path=db_path)
|
||||
row = restored.model_rows("m", now=101.0)[0]
|
||||
assert row["hop_count"] == 2
|
||||
assert row["samples"] == 1
|
||||
assert row["tps"] == 50.0
|
||||
assert row["latency_ms"] == 2000.0
|
||||
|
||||
|
||||
def _candidates_two_routes():
|
||||
fast = RouteCandidate(nodes=[], signature="m|fast", prior_tps=100.0)
|
||||
slow = RouteCandidate(nodes=[], signature="m|slow", prior_tps=50.0)
|
||||
|
||||
Reference in New Issue
Block a user