Skip to content

Commit e072db6

Browse files
jason810496claude
andcommitted
Wait for the killed leftover in the Lang-SDK processor test
SIGKILL is delivered asynchronously, so the leftover can still show as running right after the kill. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 57a417b commit e072db6

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎airflow-core/tests/unit/dag_processing/test_lang_sdk_processor.py‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ def _is_running(pid: int) -> bool:
9292
return False
9393

9494

95+
def _stops_running(pid: int, timeout: float = 10) -> bool:
96+
# SIGKILL is delivered asynchronously, so the process may still run right after the kill.
97+
deadline = time.monotonic() + timeout
98+
while _is_running(pid):
99+
if time.monotonic() > deadline:
100+
return False
101+
time.sleep(0.05)
102+
return True
103+
104+
95105
@pytest.fixture(autouse=True)
96106
def _coordinator():
97107
with fake_coordinator():
@@ -372,7 +382,7 @@ def reply(request, comms):
372382
"The Lang-SDK runtime left processes holding its output after its parse result; killing them"
373383
in cap_structlog
374384
)
375-
assert not _is_running(int((tmp_path / "leftover.pid").read_text()))
385+
assert _stops_running(int((tmp_path / "leftover.pid").read_text()))
376386

377387
@pytest.mark.parametrize(
378388
("policy", "error"),

0 commit comments

Comments
 (0)