Skip to content

[core][autoscaler][v2] Fix invalid default stats factory in ClusterStatus#62934

Merged
edoakes merged 3 commits into
ray-project:masterfrom
weimingdiit:fix/autoscaler-v2-cluster-status-default-stats
Jun 5, 2026
Merged

[core][autoscaler][v2] Fix invalid default stats factory in ClusterStatus#62934
edoakes merged 3 commits into
ray-project:masterfrom
weimingdiit:fix/autoscaler-v2-cluster-status-default-stats

Conversation

@weimingdiit

@weimingdiit weimingdiit commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Description

ClusterStatus.stats currently uses field(default_factory=Stats), but
Stats requires the positional argument gcs_request_time_s.

As a result, ClusterStatus() cannot be default-constructed and raises:

TypeError: Stats.__init__() missing 1 required positional argument: 'gcs_request_time_s'

This PR fixes the invalid default by making ClusterStatus construct a valid default Stats object, and adds a regression test to cover the empty/default construction path.

This is a small schema-level fix and does not change the normal populated paths where callers already pass an explicit Stats(...) instance.

Related issues

#62933

Additional information

Implementation notes:
update ClusterStatus.stats to use a valid default Stats value add a regression test for ClusterStatus()

@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 updates the ClusterStatus schema to initialize the stats field with a default gcs_request_time_s value of 0.0 and adds a unit test to verify these defaults. Feedback was provided to improve PEP 8 compliance by ensuring top-level functions in the test file are separated by two blank lines.

Comment thread python/ray/autoscaler/v2/tests/test_schema.py
Comment thread python/ray/autoscaler/v2/schema.py Outdated
@weimingdiit weimingdiit force-pushed the fix/autoscaler-v2-cluster-status-default-stats branch 2 times, most recently from b9a7147 to 21e9bd3 Compare April 25, 2026 06:31
@weimingdiit weimingdiit marked this pull request as ready for review April 25, 2026 06:32
@weimingdiit weimingdiit requested a review from a team as a code owner April 25, 2026 06:32
@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Apr 25, 2026
@weimingdiit weimingdiit force-pushed the fix/autoscaler-v2-cluster-status-default-stats branch from 21e9bd3 to 912e825 Compare April 25, 2026 07:46
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Apr 25, 2026
@edoakes edoakes enabled auto-merge (squash) April 25, 2026 12:56
…atus

Signed-off-by: weimingdiit <weimingdiit@gmail.com>
Signed-off-by: weimingdiit <weimingdiit@gmail.com>
auto-merge was automatically disabled April 25, 2026 15:24

Head branch was pushed to by a user without write access

@weimingdiit weimingdiit force-pushed the fix/autoscaler-v2-cluster-status-default-stats branch from 912e825 to 53ff58d Compare April 25, 2026 15:24
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label May 10, 2026
@rueian

rueian commented May 10, 2026

Copy link
Copy Markdown
Contributor

Hi @edoakes, the previous auto-merge was disabled. Please merge this when you get a chance. Thanks!

@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels May 10, 2026
Comment thread python/ray/autoscaler/v2/schema.py Outdated
Signed-off-by: Rueian <rueiancsie@gmail.com>
@edoakes edoakes merged commit 29a3418 into ray-project:master Jun 5, 2026
5 of 6 checks passed
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 unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants