refactor(distributed): make handle_fn and launch_nowait share the call halves - #297
Closed
haonan3 wants to merge 1 commit into
Closed
refactor(distributed): make handle_fn and launch_nowait share the call halves#297haonan3 wants to merge 1 commit into
haonan3 wants to merge 1 commit into
Conversation
…l halves Extract _launch_half (dispatch -> localize -> execute) and _collect_half (ray.get -> rebind -> collect) on Handle; handle_fn, launch_nowait, and PendingHandleCall.result now sequence the same two methods instead of carrying keep-in-parity copies. No behavior change: the grad-context preamble/postamble stays in handle_fn, launch_nowait stays grad_mode=False/call_id=None.
Collaborator
Author
|
Folding back into #295 per team decision — the handle-halves commit stays cleanly separated as that PR's first commit; reviewers can review it per-commit there. |
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.
Summary
Extract
_launch_half(dispatch → localize → execute) and_collect_half(ray.get → rebind → collect) onHandle;handle_fn,launch_nowait, andPendingHandleCall.resultnow sequence the same two methods instead of carrying keep-in-parity copies — the "keep the halves in parity" comment convention (#287's own listed follow-up) is deleted. No behavior change: the grad-context preamble/postamble stays inhandle_fn;launch_nowaitstaysgrad_mode=False/call_id=None.Split out of #295 per review: this is a distributed-RPC-layer change with its own reviewers and regression surface, independent of the rollout refactor that consumes the seam.
Related Issue
N/A (follow-up to #287).
Test Plan
ruff format --check+ruff checkoverunirl/distributed/group/handle.py— clean;python3 -m compileall— clean.handle_fnon every @distributed call;launch_nowaiton the async trainers); the refactor(rollout): dedup async driver plumbing; extract ToolAgentHarness #295 validation trio covers it.Compatibility / Risk
No public surface change;
_execute_all/_rebind_tree/_method_configsuntouched. Riskiest spot: none identified — the halves are verbatim relocations.Reviewer Notes
AI-assisted (Claude Code). Suggested land order: this → #294 → #295 (all touch adjacent layers; each rebases mechanically).
Checklist