Merge main and preserve dispatch backlog across monitor windows

Signed-off-by: Sy03 <1370724210@qq.com>
This commit is contained in:
Sy03 committed 2026-09-21 17:13:27 +08:00
commit ea7de7e3de
769 files changed
+73802 -22805

No files matched your search

+25
View File
@@ -65,6 +65,31 @@ def test_note_loop_and_flush_json(tmp_path, monkeypatch):
assert payload["replicas"]["stage=0,replica=0"]["inflight"] == [10]
@pytest.mark.parametrize("drain", [False, True])
def test_dispatch_backlog_carries_across_windows(tmp_path, monkeypatch, drain):
out_path = tmp_path / "orch_monitor.json"
monkeypatch.setenv("VLLM_OMNI_ORCH_MONITOR_PATH", str(out_path))
now = [0.0]
monkeypatch.setattr(time, "monotonic", lambda: now[0])
monitor = OrchestratorMonitor(replica_sampler=lambda: {})
monitor.set_dispatch_queue_size(3)
monitor.set_dispatch_queue_size(1)
now[0] = monitor_mod._WINDOW_S
monitor.note_loop(idle=False)
if drain:
monitor.set_dispatch_queue_size(0)
now[0] += monitor_mod._WINDOW_S
monitor.note_loop(idle=False)
now[0] += monitor_mod._WINDOW_S
monitor.flush()
windows = json.loads(out_path.read_text())["windows"]
remaining = 0 if drain else 1
assert windows["dispatch_queue_size"] == [1, remaining, remaining]
assert windows["dispatch_queue_high_water"] == [3, 1, remaining]
def test_register_replica_backfills_prior_windows(tmp_path, monkeypatch):
out_path = tmp_path / "orch_monitor.json"
monkeypatch.setenv("VLLM_OMNI_ORCH_MONITOR_PATH", str(out_path))