[Autoscaler] Support environment variable configuration for log rotation and deduplicate label deprecation warnings#63955
[Autoscaler] Support environment variable configuration for log rotation and deduplicate label deprecation warnings#63955daiping8 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request limits the warning about ignored labels in KubeRay to log only once and introduces environment variables to configure log rotation parameters. A review comment suggests defensively parsing these environment variables to prevent potential startup crashes due to malformed values.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 0511383. Configure here.
…ion and deduplicate label deprecation warnings Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>

Motivation
This PR addresses two operational issues in the KubeRay autoscaler:
Log Rotation Flexibility: Operators need to customize log rotation settings based on their deployment environment's disk space and retention policies. Hardcoded values don't work well across different environments (development vs production, small vs large clusters).
Log Noise Reduction: The repeated deprecation warning for
rayStartParams.labelsclutters logs, making it harder to identify genuine issues. Since KubeRay v1.5+ recommends using the top-levelLabelsfield, the warning should inform users once without spamming.Implementation Details
Files Modified
python/ray/autoscaler/_private/kuberay/run_autoscaler.pypython/ray/autoscaler/_private/kuberay/autoscaling_config.pyChanges
1. Environment Variable Configuration for Log Rotation
File:
run_autoscaler.pyAdded support for
RAY_ROTATION_MAX_BYTESandRAY_ROTATION_BACKUP_COUNTenvironment variables:Usage Example:
2. Deduplicate Label Deprecation Warning
File:
autoscaling_config.pyAdded
log_once()to ensure the warning is printed only once:The
log_once()function fromray.util.debuguses an internal flag to ensure the message is logged only the first time the condition is met.Breaking Changes
None. This is a backward-compatible enhancement:
Verification
Test Log Rotation Configuration
kubectl set env deployment/raycluster-kuberay-head \ RAY_ROTATION_MAX_BYTES=10485760 \ RAY_ROTATION_BACKUP_COUNT=5Test Label Warning Deduplication
rayStartParams.labels:Unit Tests
No new tests added - this is a configuration enhancement that doesn't change core autoscaler logic. Existing tests should continue to pass.
Related Issues
Close #63954