Skip to content

[Serve] set last scale up/down time on autoscaling context#59057

Merged
abrarsheikh merged 3 commits into
masterfrom
59001-abrar-auto
Dec 2, 2025
Merged

[Serve] set last scale up/down time on autoscaling context#59057
abrarsheikh merged 3 commits into
masterfrom
59001-abrar-auto

Conversation

@abrarsheikh

Copy link
Copy Markdown
Contributor

fixes #59001

Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh added the go add ONLY when ready to merge, run all tests label Nov 28, 2025
@abrarsheikh abrarsheikh marked this pull request as ready for review December 1, 2025 18:47
@abrarsheikh abrarsheikh requested a review from a team as a code owner December 1, 2025 18:47
)

# Record the scaling event timestamp
self._autoscaling_state_manager.record_scaling_event(self._id, new_num, old_num)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Scaling event timestamp not recorded on early return

The record_scaling_event call is placed after an early return condition (lines 2340-2346). When is_within_bounds() returns False, the function returns True at line 2346 without ever calling record_scaling_event(), even though the target state was already changed at line 2336. This means scaling event timestamps won't be recorded when a deployment has running replicas outside its autoscaling bounds, causing last_scale_up_time and last_scale_down_time to be stale or None in subsequent autoscaling decisions.

Fix in Cursor Fix in Web

@ray-gardener ray-gardener Bot added the serve Ray Serve Related Issue label Dec 1, 2025

@harshit-anyscale harshit-anyscale 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.

minor comments, else LGTM!

Comment thread python/ray/serve/tests/test_autoscaling_policy.py Outdated
Comment thread python/ray/serve/tests/unit/test_deployment_state.py Outdated
Comment thread python/ray/serve/_private/deployment_state.py Outdated
Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh merged commit c9aa1b3 into master Dec 2, 2025
6 checks passed
@abrarsheikh abrarsheikh deleted the 59001-abrar-auto branch December 2, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests serve Ray Serve Related Issue

3 participants