Skip to content

refactor async_init API to allow re-create later - #839

Merged
fzyzcjy merged 6 commits into
mainfrom
refactor_with_ref
Apr 3, 2026
Merged

refactor async_init API to allow re-create later#839
fzyzcjy merged 6 commits into
mainfrom
refactor_with_ref

Conversation

@fzyzcjy

@fzyzcjy fzyzcjy commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

b/c we need to recreate things in ft, it is good to make it all in ctor

fzyzcjy added 2 commits March 31, 2026 09:46
with_ref is a per-group constant determined at creation time (like role),
not a per-init-call parameter. Moving it to the constructor eliminates
the need to pass it through async_init and makes it available for
stop/start recovery without hacky state caching.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the RayTrainGroup class to store the with_ref flag as an instance attribute, simplifying the async_init method. The review feedback suggests further streamlining the API by also storing the role attribute within the class and removing it from the async_init signature. Additionally, the reviewer recommends updating the allocate_train_group helper to accept a role parameter to ensure that critic models are initialized with the correct internal state and fixing minor typos in the docstrings.

Comment thread miles/ray/actor_group.py
Comment thread miles/ray/placement_group.py
Comment thread miles/ray/placement_group.py
Comment thread miles/ray/placement_group.py
Comment thread miles/ray/placement_group.py
@fzyzcjy

fzyzcjy commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the RayTrainGroup class by moving the role and with_ref parameters from the async_init method to the class constructor. This change ensures that these properties are stored as instance attributes and simplifies the async_init call. Related functions like allocate_train_group and create_training_models have been updated to support this new initialization flow. Feedback was provided regarding inconsistent type hinting in the allocate_train_group function signature.

Comment thread miles/ray/placement_group.py
@fzyzcjy
fzyzcjy merged commit c5aed62 into main Apr 3, 2026
17 checks passed
@fzyzcjy
fzyzcjy deleted the refactor_with_ref branch April 3, 2026 06:16
fzyzcjy added a commit that referenced this pull request Apr 3, 2026
Resolve conflicts combining async conversion (HEAD) with #839's
role/with_ref-at-init pattern (main):
- actor_group.py: init() now async + uses self.args/self.role/self.with_ref
- placement_group.py: call sites use parameterless init()
GuanxingLu pushed a commit to GuanxingLu/miles that referenced this pull request Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants