Stop harness when feasible probe reaches search high
This commit is contained in:
@@ -600,6 +600,68 @@ class CoreFlowTests(unittest.TestCase):
|
||||
self.assertIsNotNone(proposal)
|
||||
self.assertTrue(proposal.should_stop)
|
||||
|
||||
def test_harness_stop_allows_feasible_high_probe_with_some_failures(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tmp_path = Path(tmp)
|
||||
study_path = _write_study_assets(tmp_path)
|
||||
study = load_study_spec(study_path)
|
||||
result_path = tmp_path / "trial-0004.json"
|
||||
result_path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"status": "completed",
|
||||
"best_sampling_u": 0.99609375,
|
||||
"best_request_rate": 1.77,
|
||||
"best_pass_rate": 0.968,
|
||||
"probes": [
|
||||
{
|
||||
"threshold": 0.99609375,
|
||||
"feasible": True,
|
||||
"payload": {
|
||||
"request_count": 1063,
|
||||
"pass_rate": 0.968,
|
||||
"request_rate": 1.77,
|
||||
"early_stopped": False,
|
||||
"early_stop_reason": "",
|
||||
"latency_summary": {
|
||||
"failed_reason_counts": {
|
||||
"tpot_ms>50.0": 34,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
state = StudyState(
|
||||
study_id=study.study_id,
|
||||
best_trial_id="trial-0004",
|
||||
best_request_rate=1.77,
|
||||
best_request_rate_per_gpu=0.4425,
|
||||
trials=[
|
||||
TrialSummary(
|
||||
trial_id="trial-0004",
|
||||
status="completed",
|
||||
best_request_rate=1.77,
|
||||
best_request_rate_per_gpu=0.4425,
|
||||
result_path=str(result_path),
|
||||
config_patch={
|
||||
"env_patch": {},
|
||||
"flag_patch": {"tensor-parallel-size": 4},
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
context = build_harness_context(
|
||||
study=study,
|
||||
window_summary={"prompt_tokens_p95": 2048},
|
||||
state=state,
|
||||
)
|
||||
self.assertTrue(context["harness_stop"]["should_stop"])
|
||||
self.assertEqual(context["harness_stop"]["reason"], "search_high_saturated_by_incumbent")
|
||||
|
||||
def test_harness_guided_first_tp_probe_for_latency_bottleneck(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tmp_path = Path(tmp)
|
||||
|
||||
Reference in New Issue
Block a user