[CI] Skip exited descendants when finding the worker in the FT e2e test (#61648)

Signed-off-by: Oxana Korzh <okorzh@amd.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Oxana Korzh
2026-10-15 16:08:14 +00:00
committed by GitHub
co-authored by Claude Opus 5.5 Andreas Karatzas
parent ed3050add4
commit d6f0b7a416
@@ -190,11 +190,13 @@ def _apply_ft(server, instruction: str, params: dict | None = None) -> dict:
def _kill_worker_process(server) -> None:
"""SIGKILL only the worker proc, leaving EngineCore and API server alive."""
workers = [
p
for p in psutil.Process(server.proc.pid).children(recursive=True)
if "Worker" in " ".join(p.cmdline())
]
workers = []
for p in psutil.Process(server.proc.pid).children(recursive=True):
# Skip descendants that already exited: cmdline() raises ZombieProcess
# if unreaped, NoSuchProcess if reaped. A dead worker still fails below.
with contextlib.suppress(psutil.ZombieProcess, psutil.NoSuchProcess):
if "Worker" in " ".join(p.cmdline()):
workers.append(p)
assert len(workers) == 1, f"expected 1 worker proc, found: {workers}"
workers[0].kill()