[Data] Deprecate V1 cluster autoscaler in favor of V2#60474
[Data] Deprecate V1 cluster autoscaler in favor of V2#60474bveeramani merged 9 commits intoray-project:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request correctly deprecates the V1 cluster autoscaler in favor of V2. The default version is now V2, and using V1 will trigger a deprecation warning, as demonstrated by the tests in the description. The changes are straightforward and well-implemented.
As a suggestion for a follow-up, you might consider updating the existing unit tests for DefaultClusterAutoscaler to handle the new deprecation warnings (e.g., using pytest.warns) to keep the test logs clean. This is not a blocking issue for this PR.
Signed-off-by: Ryan Huang <ryankert01@gmail.com>
ff2eff1 to
4f728a3
Compare
bveeramani
left a comment
There was a problem hiding this comment.
I think we still need to add a warnings.warn in the v1 constructor. The message for the deprecated decorator is for docs only, IiRC
|
@bveeramani I initially think it will do it there. Is that okay? ray/python/ray/util/annotations.py Lines 164 to 169 in bcb27af |
|
@ryankert01 you're right. Looks like we do emit a warning when we set I think the emitted warning is verbose and redundant with this approach.
Rather than using the |
Signed-off-by: Ryan Huang <ryankert01@gmail.com>
python/ray/data/_internal/cluster_autoscaler/default_cluster_autoscaler.py
Show resolved
Hide resolved
Signed-off-by: Ryan Huang <ryankert01@gmail.com>
|
cc @bveeramani |
| "RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default.", | ||
| RayDeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
There was a problem hiding this comment.
Duplicated deprecation message string in two places
Low Severity
The deprecation message string "DefaultClusterAutoscaler (V1) is deprecated and will be removed after June 2026..." is duplicated verbatim in both the @Deprecated decorator and the warnings.warn() call. This creates a maintenance burden since updates to the deprecation message require changes in two places, risking inconsistency if one is modified without the other.
Additional Locations (1)
There was a problem hiding this comment.
@ryankert01 if you want, feel free to deduplicate this with a constant in a follow-up PR
Signed-off-by: Ryan Huang <ryankert01@gmail.com>
|
The test failed because I changed default from v1 to v2. I change |
| @@ -101,16 +101,15 @@ def test_after_worker_group_shutdown(): | |||
| def test_split_coordinator_shutdown_executor(ray_start_4_cpus): | |||
There was a problem hiding this comment.
Possibly out-of-scope for this PR since it's an existing issue, but this test breaks Ray Core and Ray Data abstraction barriers. I think we should refactor it to test against a higher level of abstraction (e.g., the ClusterAutoscaler interface).
| "RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default.", | ||
| RayDeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
) ## Description This document describes how to verify the V1 cluster autoscaler deprecation. 1. Added `@Deprecated` annotation to `DefaultClusterAutoscaler` in `default_cluster_autoscaler.py` 2. Changed default from `V1` to `V2` in `__init__.py` ## Related issues Closes ray-project#60459 ## Additional information ### Testing **Test V1 via env var emits deprecation warning:** ```bash RAY_DATA_CLUSTER_AUTOSCALER=V1 python -c " import warnings warnings.simplefilter('always') from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` ...RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases... DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default. Created: DefaultClusterAutoscaler ``` **Test V2 (default) has no deprecation warning:** ```bash python -c " import warnings warnings.filterwarnings('always', category=DeprecationWarning) from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` Created: DefaultClusterAutoscalerV2 ``` --------- Signed-off-by: Ryan Huang <ryankert01@gmail.com>
) ## Description This document describes how to verify the V1 cluster autoscaler deprecation. 1. Added `@Deprecated` annotation to `DefaultClusterAutoscaler` in `default_cluster_autoscaler.py` 2. Changed default from `V1` to `V2` in `__init__.py` ## Related issues Closes ray-project#60459 ## Additional information ### Testing **Test V1 via env var emits deprecation warning:** ```bash RAY_DATA_CLUSTER_AUTOSCALER=V1 python -c " import warnings warnings.simplefilter('always') from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` ...RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases... DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default. Created: DefaultClusterAutoscaler ``` **Test V2 (default) has no deprecation warning:** ```bash python -c " import warnings warnings.filterwarnings('always', category=DeprecationWarning) from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` Created: DefaultClusterAutoscalerV2 ``` --------- Signed-off-by: Ryan Huang <ryankert01@gmail.com> Signed-off-by: 400Ping <jiekaichang@apache.org>
) ## Description This document describes how to verify the V1 cluster autoscaler deprecation. 1. Added `@Deprecated` annotation to `DefaultClusterAutoscaler` in `default_cluster_autoscaler.py` 2. Changed default from `V1` to `V2` in `__init__.py` ## Related issues Closes ray-project#60459 ## Additional information ### Testing **Test V1 via env var emits deprecation warning:** ```bash RAY_DATA_CLUSTER_AUTOSCALER=V1 python -c " import warnings warnings.simplefilter('always') from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` ...RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases... DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default. Created: DefaultClusterAutoscaler ``` **Test V2 (default) has no deprecation warning:** ```bash python -c " import warnings warnings.filterwarnings('always', category=DeprecationWarning) from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` Created: DefaultClusterAutoscalerV2 ``` --------- Signed-off-by: Ryan Huang <ryankert01@gmail.com> Signed-off-by: Sirui Huang <ray.huang@anyscale.com>
## Description This document describes how to verify the V1 cluster autoscaler deprecation. 1. Added `@Deprecated` annotation to `DefaultClusterAutoscaler` in `default_cluster_autoscaler.py` 2. Changed default from `V1` to `V2` in `__init__.py` ## Related issues Closes #60459 ## Additional information ### Testing **Test V1 via env var emits deprecation warning:** ```bash RAY_DATA_CLUSTER_AUTOSCALER=V1 python -c " import warnings warnings.simplefilter('always') from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` ...RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases... DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default. Created: DefaultClusterAutoscaler ``` **Test V2 (default) has no deprecation warning:** ```bash python -c " import warnings warnings.filterwarnings('always', category=DeprecationWarning) from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` Created: DefaultClusterAutoscalerV2 ``` --------- Signed-off-by: Ryan Huang <ryankert01@gmail.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
## Description This document describes how to verify the V1 cluster autoscaler deprecation. 1. Added `@Deprecated` annotation to `DefaultClusterAutoscaler` in `default_cluster_autoscaler.py` 2. Changed default from `V1` to `V2` in `__init__.py` ## Related issues Closes #60459 ## Additional information ### Testing **Test V1 via env var emits deprecation warning:** ```bash RAY_DATA_CLUSTER_AUTOSCALER=V1 python -c " import warnings warnings.simplefilter('always') from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` ...RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases... DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default. Created: DefaultClusterAutoscaler ``` **Test V2 (default) has no deprecation warning:** ```bash python -c " import warnings warnings.filterwarnings('always', category=DeprecationWarning) from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` Created: DefaultClusterAutoscalerV2 ``` --------- Signed-off-by: Ryan Huang <ryankert01@gmail.com>
) ## Description This document describes how to verify the V1 cluster autoscaler deprecation. 1. Added `@Deprecated` annotation to `DefaultClusterAutoscaler` in `default_cluster_autoscaler.py` 2. Changed default from `V1` to `V2` in `__init__.py` ## Related issues Closes ray-project#60459 ## Additional information ### Testing **Test V1 via env var emits deprecation warning:** ```bash RAY_DATA_CLUSTER_AUTOSCALER=V1 python -c " import warnings warnings.simplefilter('always') from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` ...RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases... DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default. Created: DefaultClusterAutoscaler ``` **Test V2 (default) has no deprecation warning:** ```bash python -c " import warnings warnings.filterwarnings('always', category=DeprecationWarning) from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` Created: DefaultClusterAutoscalerV2 ``` --------- Signed-off-by: Ryan Huang <ryankert01@gmail.com> Signed-off-by: Adel Nour <ans9868@nyu.edu>
) ## Description This document describes how to verify the V1 cluster autoscaler deprecation. 1. Added `@Deprecated` annotation to `DefaultClusterAutoscaler` in `default_cluster_autoscaler.py` 2. Changed default from `V1` to `V2` in `__init__.py` ## Related issues Closes ray-project#60459 ## Additional information ### Testing **Test V1 via env var emits deprecation warning:** ```bash RAY_DATA_CLUSTER_AUTOSCALER=V1 python -c " import warnings warnings.simplefilter('always') from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` ...RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases... DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default. Created: DefaultClusterAutoscaler ``` **Test V2 (default) has no deprecation warning:** ```bash python -c " import warnings warnings.filterwarnings('always', category=DeprecationWarning) from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` Created: DefaultClusterAutoscalerV2 ``` --------- Signed-off-by: Ryan Huang <ryankert01@gmail.com> Signed-off-by: peterxcli <peterxcli@gmail.com>
) ## Description This document describes how to verify the V1 cluster autoscaler deprecation. 1. Added `@Deprecated` annotation to `DefaultClusterAutoscaler` in `default_cluster_autoscaler.py` 2. Changed default from `V1` to `V2` in `__init__.py` ## Related issues Closes ray-project#60459 ## Additional information ### Testing **Test V1 via env var emits deprecation warning:** ```bash RAY_DATA_CLUSTER_AUTOSCALER=V1 python -c " import warnings warnings.simplefilter('always') from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` ...RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases... DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default. Created: DefaultClusterAutoscaler ``` **Test V2 (default) has no deprecation warning:** ```bash python -c " import warnings warnings.filterwarnings('always', category=DeprecationWarning) from unittest.mock import MagicMock from ray.data._internal.cluster_autoscaler import create_cluster_autoscaler mock_data_context = MagicMock() mock_data_context.execution_options.resource_limits = None autoscaler = create_cluster_autoscaler(MagicMock(), MagicMock(), mock_data_context, execution_id='test') print(f'Created: {type(autoscaler).__name__}') " ``` ``` Created: DefaultClusterAutoscalerV2 ``` --------- Signed-off-by: Ryan Huang <ryankert01@gmail.com> Signed-off-by: peterxcli <peterxcli@gmail.com>
Description
This document describes how to verify the V1 cluster autoscaler deprecation.
@Deprecatedannotation toDefaultClusterAutoscalerindefault_cluster_autoscaler.pyV1toV2in__init__.pyRelated issues
Closes #60459
Additional information
Testing
Test V1 via env var emits deprecation warning:
Test V2 (default) has no deprecation warning: