Use probe sequence bottlenecks in harness

This commit is contained in:
2026-04-28 06:57:45 +08:00
parent 39aa47fbf1
commit a9943e0240
3 changed files with 115 additions and 2 deletions

View File

@@ -532,6 +532,83 @@ class CoreFlowTests(unittest.TestCase):
"\n".join(context["proposal_rules"]),
)
def test_harness_uses_prior_infeasible_probe_for_active_bottleneck(self) -> None:
with tempfile.TemporaryDirectory() as tmp:
tmp_path = Path(tmp)
study_path = _write_study_assets(
tmp_path,
trace_overrides={"request_mode": "decode_only"},
slo_overrides={
"ttft_rule": None,
"tpot_rule": {"kind": "fixed_ms", "threshold_ms": 20},
},
engine_overrides={
"tunable_flags": [
"tensor-parallel-size",
"data-parallel-size",
"max-num-seqs",
]
},
)
result_path = tmp_path / "trial-0001-result.json"
result_path.write_text(
json.dumps(
{
"status": "completed",
"best_request_rate": 1.0,
"best_pass_rate": 1.0,
"probes": [
{
"threshold": 0.1,
"feasible": False,
"payload": {
"request_rate": 2.0,
"pass_rate": 0.1,
"early_stop_reason": "slo_pass_rate_unrecoverable",
"latency_summary": {
"failed_reason_counts": {"tpot_ms>20.0": 20}
},
},
},
{
"threshold": 0.01,
"feasible": True,
"payload": {
"request_rate": 1.0,
"pass_rate": 1.0,
"latency_summary": {"failed_reason_counts": {}},
},
},
],
}
),
encoding="utf-8",
)
study = load_study_spec(study_path)
context = build_harness_context(
study=study,
window_summary={},
state=StudyState(
study_id=study.study_id,
trials=[
TrialSummary(
trial_id="trial-0001",
status="completed",
result_path=str(result_path),
)
],
),
)
diagnostics = context["recent_trial_diagnostics"]
self.assertEqual(diagnostics[0]["active_bottleneck"], "decode_tpot")
active = {
harness["knob_family"]
for harness in context["knob_harnesses"]
if harness["active_now"]
}
self.assertIn("data-parallel-size", active)
self.assertIn("max-num-seqs", active)
def test_load_study_spec_rejects_mismatched_served_model_name(self) -> None:
with tempfile.TemporaryDirectory() as tmp:
tmp_path = Path(tmp)