[Refactor] Consolidate stats() in BaseCollector and add WandB monitoring example - #4400
Merged
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4400
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
theap06
requested changes
Sep 18, 2026
theap06
left a comment
Collaborator
There was a problem hiding this comment.
left some comments. overall design lgtm.
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.
Consolidates single-process and multiprocessing collector statistics in
BaseCollector.stats(), preserving shared in-flight trajectory counters, non-blocking aggregate snapshots, and the existing per-worker control-channel behavior. Workers return data to the coordinator, where logging happens.The public
stats()API stays the same. The before/after below shows the regression-test scenario: one healthy Ray worker is held inside its first collection call for longer than the stats timeout.Before: the stats request waits behind collection on the same actor queue, times out, and the healthy worker is omitted from the snapshot.
After: the stats request runs in its own concurrency group and can report progress while collection is still busy.
The new example uses this snapshot API through
LoggerMonitorto send aggregate and per-worker progress to W&B from the coordinator:Collection and state-changing calls retain the default actor queue. Remote polling remains timeout-bounded, and caller-supplied actor options and concurrency groups are preserved.
Validation:
TestCollectorStatscases pass, including two real-Ray tests with Ray 2.54.0.workers_alivebecomes zero.git diff --checkpass.