Add: Worker.submit with per-run completion handles - #1460
Conversation
|
Warning Review limit reached
Next review available in: 19 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I reran the smoke command on queued a2a3 hardware against this PR's exact
The job rerun REST API returns 403 for the fork author's token, so I cannot |
6e215d8 to
8e56fa6
Compare
8e56fa6 to
5999cb4
Compare
5999cb4 to
faf7963
Compare
Worker.submit() constructs the DAG synchronously and returns a RunHandle that owns the run's completion, so L3 device work may still be active after submit() returns. Worker.run() is submit(...).wait(), so existing callers keep their blocking semantics and None return. - RunHandle exposes done, wait(timeout) and result(timeout); the terminal result is cached, so repeated and concurrent waits observe the same outcome and exactly one waiter performs fence-owned cleanup and release_run - wait_run_for binds a timed native fence wait that releases the GIL - the handle retains the callback, args and config until the fence fires, so run-owned resources outlive submit() - done reports false while a concurrent waiter is publishing cleanup, so it never queries a run id that waiter is about to release - graph-construction errors stay synchronous in submit(); device and endpoint errors belong to the originating handle and do not poison a later submission - fail_run_submission closes a run out from whatever state submission reached instead of rejecting one that is no longer building: the submission failure path waits on that fence, so refusing it left the waiter blocked forever - close() fences admission and drains accepted handles before tearing down the worker tree - L2 submission stays blocking and returns an already-completed handle Only one live device run is admitted: a later submission drains the previous handle before building another DAG, so preparation of one run does not overlap execution of another.
Summary
Worker.submit(...) -> RunHandle; graph construction stays synchronous, but L3 device work may still be active whensubmit()returnsWorker.run(...)source-compatible assubmit(...).wait(), still blocking and still returningNoneRunHandleexposesdone,wait(timeout)andresult(timeout); the terminal result is cached so repeated and concurrent waits observe the same outcome_release_run; the others replay the cached resultwait_run_for, a timed native fence wait that releases the GILsubmit()close()fences admission and drains accepted handles before tearing down the worker treeGraph-construction errors remain synchronous in
submit(). Device and endpointerrors are owned by the originating handle, surface from
wait()/result(),and do not poison a later submission.
Scope
Only one live device run is admitted: a later submission drains the previous
handle before building another DAG. This deliberately does not add
prepared-run FIFO admission, a Python dispatcher thread, cancellation, or any
device overlap — preparation of run N+1 still does not overlap execution of
run N.
Series context
Part of the worker async-preparation series; follows #1459, which introduced
per-run identity, the completion fence and per-run error isolation. Prepared-run
admission, K=2 resources and device overlap come later.
Rebase
#1459 has landed, so this branch is rebased onto merged
mainand thesuperseded run-fence commit is dropped. The diff is now this PR's own increment
only: 9 files, +582/-76.
The
worker.pyconflict against the final #1459 implementation was resolved bykeeping this PR's
_submit_l3_lockedrestructure (submission no longer waits;cleanup moved into
RunHandle) and re-applying #1459's failure-messageplumbing, so a graph-construction failure still reaches the run fence:
_fail_run_submission(run_id, _format_exc("orchestration", e)).Validation
Re-run after the rebase onto merged
main:ctest --test-dir tests/ut/cpp/build -LE requires_hardware)pytest tests/ut)The architecture-probe and hardware runs quoted before the rebase were against
8e56fa6aand have not been re-run against the current head. GitHub CI is theautomated regression stage.