Skip to content

[Autoscaler][v2] Fix instance_type_name in autoscaling state#62101

Merged
edoakes merged 2 commits into
ray-project:masterfrom
weimingdiit:fix/v2-autoscaling-state-instance-type-fields
Apr 24, 2026
Merged

[Autoscaler][v2] Fix instance_type_name in autoscaling state#62101
edoakes merged 2 commits into
ray-project:masterfrom
weimingdiit:fix/v2-autoscaling-state-instance-type-fields

Conversation

@weimingdiit

@weimingdiit weimingdiit commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Description

Populate instance_type_name in the autoscaling state generated by the v2 reconciler.

Previously _fill_autoscaling_state() only populated ray_node_type_name for pending instance requests, pending instances, and failed instance requests. As a result, downstream consumers could observe empty provider instance types in parsed autoscaler status.

Use autoscaling_config.get_provider_instance_type() to fill instance_type_name.

Related issues

#62100

@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 enhances the autoscaling state by including provider-specific instance type names for pending and failed requests as well as pending instances. It updates the _fill_autoscaling_state function to perform these lookups via the autoscaling_config and adjusts the test suite to verify these new fields. Review feedback highlights a bug in the test aggregation logic that could lead to incorrect counts and suggests refactoring redundant lookups into a mapping for better efficiency and maintainability.

Comment thread python/ray/autoscaler/v2/tests/test_reconciler.py Outdated
Comment thread python/ray/autoscaler/v2/instance_manager/reconciler.py
@weimingdiit weimingdiit force-pushed the fix/v2-autoscaling-state-instance-type-fields branch 2 times, most recently from 863ef7a to b465a20 Compare March 27, 2026 09:56
@rueian rueian self-requested a review March 27, 2026 18:11
@rueian rueian self-assigned this Mar 27, 2026
@weimingdiit weimingdiit marked this pull request as ready for review March 28, 2026 02:32
@weimingdiit weimingdiit requested a review from a team as a code owner March 28, 2026 02:32
@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Mar 28, 2026
@weimingdiit

Copy link
Copy Markdown
Contributor Author

Hi @Kunchd @rueian, the PR is ready now. Could you please take another look when you have chance? Really appreciate it.

Comment thread python/ray/autoscaler/v2/instance_manager/reconciler.py Outdated
@weimingdiit weimingdiit force-pushed the fix/v2-autoscaling-state-instance-type-fields branch from b465a20 to 0ad4b4a Compare April 4, 2026 06:45

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 0ad4b4a1c43032a96151a1233b908e82459f6ac7. Configure here.

Comment thread python/ray/autoscaler/v2/instance_manager/reconciler.py Outdated
@weimingdiit

Copy link
Copy Markdown
Contributor Author

Hi @rueian, the code has been updated. Could you please take another look?

@rueian rueian added the go add ONLY when ready to merge, run all tests label Apr 10, 2026
Populate `instance_type_name` in the autoscaling state generated by the v2 reconciler.

Previously `_fill_autoscaling_state()` only populated `ray_node_type_name` for pending instance requests, pending instances, and failed instance requests. As a result, downstream consumers could observe empty provider instance types in parsed autoscaler status.

Use `autoscaling_config.get_provider_instance_type()` to fill `instance_type_name`.

Also harden the provider instance type lookup against missing node configs and update the reconciler unit test to assert both fields.

Signed-off-by: weimingdiit <weimingdiit@gmail.com>
Signed-off-by: weimingdiit <weimingdiit@gmail.com>
@weimingdiit weimingdiit force-pushed the fix/v2-autoscaling-state-instance-type-fields branch from 3167c3a to e7259eb Compare April 16, 2026 15:21
@rueian

rueian commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Hi @edoakes, please help merge this PR 🙏

1 similar comment
@rueian

rueian commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Hi @edoakes, please help merge this PR 🙏

@edoakes edoakes merged commit 28543ed into ray-project:master Apr 24, 2026
6 checks passed
@weimingdiit

Copy link
Copy Markdown
Contributor Author

@rueian @edoakes Thanks for your review and merge.

@edoakes

edoakes commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

@weimingdiit thanks for the contribution!

Lucas61000 pushed a commit to Lucas61000/ray that referenced this pull request May 15, 2026
…ject#62101)

Populate `instance_type_name` in the autoscaling state generated by the
v2 reconciler.

Previously `_fill_autoscaling_state()` only populated
`ray_node_type_name` for pending instance requests, pending instances,
and failed instance requests. As a result, downstream consumers could
observe empty provider instance types in parsed autoscaler status.

Use `autoscaling_config.get_provider_instance_type()` to fill
`instance_type_name`.


## Related issues
ray-project#62100

---------

Signed-off-by: weimingdiit <weimingdiit@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests

3 participants