Repository navigation
pd: producer failure handling, readiness gate and stage metrics (#238, #246, #249) - #282
Merged
Merged
Conversation
…#246, #249) From feat/249-pd-stage-metrics (#239, #247, #250): SubprocessPrefillWorker failure settling, producer readiness gating /ready and admission, producer stage-duration metrics; only the /ready hunk of llmd.py. Fixes on top: - SubprocessPrefillWorker.close() closes stdin and waits for a clean exit before SIGTERM, then SIGKILL (prefill_server exits on stdin EOF; SIGTERM first skipped SDK cleanup that releases the device). - ProcessPrefillWorker.ready: a dead child now fails readiness and admission is rejected with 503 instead of quarantining the batcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
A failed PD prefill producer could leave requests pending, keep
/readygreen and get the batcher quarantined on the next admission; producer stage durations were not exported. This lands that work from a draft stack, with two fixes found in review.Changes
From
feat/249-pd-stage-metrics(#239, #247, #250):opt_prime/opt_prime/accel/pd/pd_batching.py:SubprocessPrefillWorkersettles every pending future on child exit or a malformed reply, rejects new work after a terminal failure, cleans up the child and shared memory on failed startup, exposesready;PrefillWorkerPool.ready.opt_prime/opt_prime/accel/serve/batched.py:BatchedService.ready, admission returns 503 retryable while the producer is unready,airm_pd_producer_seconds_total{stage=prefill|transfer}.opt_prime/opt_prime/accel/serve/llmd.py: only the/readyhunk (fromexp/240-gpu-live-pd...fix/246-pd-producer-readiness); the rest of the file is untouched so the SIGPIPE fix in the serving PR is not reverted.test_subprocess_prefill_failure.py,test_pd_producer_readiness.py,test_pd_stage_metrics.py(new).Fixes on top (test first):
SubprocessPrefillWorker.close()now closes stdin and waits for the child to exit, thenterminate(), thenkill().prefill_serverexits itsfor line in sys.stdinloop on EOF; SIGTERM first skipped the SDK cleanup that releases the RNGD device. Testtest_close_lets_child_exit_cleanly_on_stdin_eof. The existing test that a child ignoring SIGTERM is still killed is kept and passes.ProcessPrefillWorker.ready(self._futures is not None and self._proc.is_alive()), so the readiness gate sees a dead child. Testtest_dead_process_worker_is_unready_and_rejects_admission: child killed,/ready503, completion 503 retryable, service not poisoned.Verification
pytest -q tests/test_subprocess_prefill_failure.py tests/test_pd_producer_readiness.py tests/test_pd_stage_metrics.py: 16 passed.returncode -15 != 0, no clean-exit marker); F2 test failed (/readyreturned 200 after the child was killed).pytest -q tests/test_pd_batching_disagg.py(existing tests of both worker classes): 12 passed.Compatibility and limits
close()can now take up to2 * timeout(default 5 s each) before SIGKILL for a child that ignores stdin EOF and SIGTERM.llmd.py, in separate hunks.Related Issue
Closes #238
Closes #246
Closes #249
Supersedes #239, #247, #250.
🤖 Generated with Claude Code