[ROCm] Give EngineCore cleanup grace after request abort (#52281)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Andreas Karatzas
2026-08-19 11:39:59 -05:00
committed by GitHub
co-authored by OpenAI Codex mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent e9e1630e93
commit 3a386cfaf5
5 changed files with 221 additions and 3 deletions
@@ -242,6 +242,40 @@ def test_handles_shutdown_event():
assert supervisor.is_ready is False
@pytest.mark.asyncio
async def test_shutdown_children_uses_engine_process_timeout(
monkeypatch: pytest.MonkeyPatch,
):
supervisor = DPSupervisor(_make_unit_args(shutdown_timeout=0.0))
supervisor._processes = [
SimpleNamespace(name="APIServer_DPRank_4", pid=None, is_alive=lambda: False)
]
calls = []
timeout_calls = []
def get_process_timeout(request_timeout, manager_timeout):
timeout_calls.append((request_timeout, manager_timeout))
return 15.0
monkeypatch.setattr(
dp_sup,
"get_engine_process_shutdown_timeout",
get_process_timeout,
)
monkeypatch.setattr(
dp_sup,
"_join_processes_with_timeout",
lambda processes, timeout: calls.append((processes, timeout)),
)
await supervisor._shutdown_children()
assert timeout_calls == [(0.0, 0.0)]
assert calls == [
(supervisor._processes, 15.0 + CHILD_EXIT_GRACE_S),
]
@pytest.mark.asyncio
async def test_handles_child_exit(
monkeypatch: pytest.MonkeyPatch,