[core][autoscaler][v1] add heartbeat timeout logic to determine node activity status #54030
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.
Why are these changes needed?
This PR is related to #52198.
When a worker is reported as active by the node provider, the autoscaler marks it as active in the summary—even if the worker’s raylet has already exited. This results in stale nodes being incorrectly shown as active in the cluster status.
This issue still occurs even after the previous PR was applied, which intended to fix the heartbeat-based activity check. The reason is that the logic used to determine node activeness in non_terminated_nodes still relies solely on the presence of the following internal mappings:
If these entries exist, the autoscaler assumes the node is active—even if the underlying raylet process has already exited.
Thus, when a raylet exits after idle timeout but the NodeProvider continues to return the node, the autoscaler still marks it as active. This behavior is incorrect and leads to inaccurate autoscaler summaries.
Proposed
The
is_active
() method should not rely solely on the existence of the above variables. Instead, it should check whether the time since the last heartbeat exceeds AUTOSCALER_HEARTBEAT_TIMEOUT_S. This way, nodes with outdated or missing heartbeats can be correctly identified as inactive.Current Behavior (Observed)
1. Marked as Active Despite Raylet Exit (ip: 172.28.0.16)
2. Worker Only Removed After Idle Timeout Expires
In the current system, the following sequence occurs:
Related issue number
#52198
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.