Refactor rollout.py by file decompositions - #899
Conversation
Requires mechanical move PRs to include a reproducible transform script as a gist. The script is fully self-contained: creates a worktree, replays the transformation with commits, diffs against the PR, and reports pass/fail. PR description includes a one-liner verification command.
(cherry picked from commit b42aa4e)
Note: rollout_ft/0 was already merged into main as PR #897 and deleted from origin, so the cascade starts from main → rollout_ft/1. Conflict 1: miles/ray/rollout.py (modify/delete) - HEAD (rollout_ft/1) deleted the file as part of a mechanical split: commit d3fc26e "mechanically move" splits the original 1298-line miles/ray/rollout.py into the directory miles/ray/rollout/{addr_allocator, metrics,observability,rollout_manager,rollout_server,router_manager, server_group}.py. - origin/main modified the file (4 commits since merge-base): a772c33 zero_std all_zero_ratio/all_one_ratio metrics (#1034) 41615af weight staleness control for fully async rollout (#958) c198efa consistent hashing routing policy (#891) eaa36a2 heartbeat and id to session server (#866) Resolution: removed miles/ray/rollout.py (preserve mechanical split) and re-applied main's 7 hunks to the new directory files: - miles/ray/rollout/router_manager.py: + import uuid + router_args.policy = args.sglang_router_policy (in start_router) + args.session_server_instance_id = uuid.uuid4().hex (in start_session_server) - miles/ray/rollout/train_data_conversion.py: + train_data["weight_versions"] population (after multimodal block) + "weight_versions" added to per-DP-split key whitelist - miles/ray/rollout/metrics.py: + oldest_weight_version statistics + mixed_version_ratio in _compute_metrics_from_samples + zero_std/all_zero_percentage and all_one_percentage in _compute_zero_std_metrics Verified: all dependent symbols (Sample.weight_versions, Sample.oldest_weight_version, args.sglang_router_policy, args.session_server_instance_id) are already present in the merged tree from cleanly-merged peer files (miles/utils/types.py, miles/backends/sglang_utils/arguments.py, etc.). Verified: merge_diff_check.py shows the only "lost" deviations are PR #897 skill files (already in main) — no real loss.
|
Heads up — I merged The conflict (only one in the entire 32-branch cascade)
ResolutionRemoved the orphaned
Merge commit: Verification
|
miles/ray/rollout.py: modify/delete conflict. rollout_ft/1 split this file into the miles/ray/rollout/ package; main (#1164 Bump sglang to v0.5.12) added env var SGLANG_OPT_USE_CUSTOM_ALL_REDUCE_V2 to ServerGroup. Re-applied main's new env key to its moved location miles/ray/rollout/server_group.py and kept the file deletion.
|
Verified the mechanical refactor via the one-click transform script: python3 <(curl -sL https://gist.githubusercontent.com/fzyzcjy/f479621f729158542dc22db3d17f2929/raw/transform_rollout_split.py)Result: The script checks out |
Mechanical Move
Transform script: https://gist.github.com/fzyzcjy/f479621f729158542dc22db3d17f2929
One-click verification
python3 <(curl -sL https://gist.githubusercontent.com/fzyzcjy/f479621f729158542dc22db3d17f2929/raw/transform_rollout_split.py)