Skip to content

[Data] Deprecate V1 cluster autoscaler in favor of V2#60474

Merged
bveeramani merged 9 commits intoray-project:masterfrom
ryankert01:deprecate-autoscaler-v1
Jan 30, 2026
Merged

[Data] Deprecate V1 cluster autoscaler in favor of V2#60474
bveeramani merged 9 commits intoray-project:masterfrom
ryankert01:deprecate-autoscaler-v1

Conversation

@ryankert01
Copy link
Member

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:

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:

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

@ryankert01 ryankert01 requested a review from a team as a code owner January 24, 2026 13:39
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 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>
@ryankert01 ryankert01 force-pushed the deprecate-autoscaler-v1 branch from ff2eff1 to 4f728a3 Compare January 24, 2026 13:47
@ray-gardener ray-gardener bot added docs An issue or change related to documentation data Ray Data-related issues deprecation Scheduled for deprecation community-contribution Contributed by the community labels Jan 24, 2026
Copy link
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

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

@ryankert01
Copy link
Member Author

ryankert01 commented Jan 25, 2026

@bveeramani I initially think it will do it there. Is that okay?

def patched_init(*args, **kwargs):
warnings.warn(warning_message, RayDeprecationWarning, stacklevel=2)
return obj_init(*args, **kwargs)
obj.__init__ = patched_init
return obj

@ryankert01 ryankert01 requested a review from bveeramani January 25, 2026 04:07
@bveeramani
Copy link
Member

@ryankert01 you're right. Looks like we do emit a warning when we set warning=True in Deprecated.

I think the emitted warning is verbose and redundant with this approach.

Users/balaji/ray/python/ray/data/_internal/cluster_autoscaler/init.py:48: RayDeprecationWarning: This API is deprecated and may be removed in future Ray releases. You could suppress this warning by setting env variable PYTHONWARNINGS="ignore::DeprecationWarning"
DefaultClusterAutoscaler (V1) is deprecated. Use DefaultClusterAutoscalerV2 instead by setting RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default.

Rather than using the warning=True flag (which introduces the redundant deprecation message), could we not set warning=True and instead explicitly emit a warning in the autoscaler constructor, and also add "is deprecated and will be removed after June 2026."?

Signed-off-by: Ryan Huang <ryankert01@gmail.com>
@ryankert01
Copy link
Member Author

cc @bveeramani

Copy link
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

nice ty

@bveeramani bveeramani enabled auto-merge (squash) January 27, 2026 17:34
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Jan 27, 2026
@github-actions github-actions bot disabled auto-merge January 28, 2026 02:32
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

"RAY_DATA_CLUSTER_AUTOSCALER=V2 or using the default.",
RayDeprecationWarning,
stacklevel=2,
)
Copy link

Choose a reason for hiding this comment

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

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)

Fix in Cursor Fix in Web

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Member

Choose a reason for hiding this comment

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

@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>
@ryankert01 ryankert01 requested a review from a team as a code owner January 28, 2026 04:45
@ryankert01
Copy link
Member Author

The test failed because I changed default from v1 to v2. I change requestor to coordinator to make the test respect autoscaler v2.
cc @bveeramani

Copy link
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

Data changes LGTM

@@ -101,16 +101,15 @@ def test_after_worker_group_shutdown():
def test_split_coordinator_shutdown_executor(ray_start_4_cpus):
Copy link
Member

Choose a reason for hiding this comment

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

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,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@bveeramani bveeramani merged commit 76304d0 into ray-project:master Jan 30, 2026
6 checks passed
liulehui pushed a commit to liulehui/ray that referenced this pull request Jan 31, 2026
)

## 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>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Feb 1, 2026
)

## 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>
rayhhome pushed a commit to rayhhome/ray that referenced this pull request Feb 4, 2026
)

## 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>
elliot-barn pushed a commit that referenced this pull request Feb 9, 2026
## 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>
elliot-barn pushed a commit that referenced this pull request Feb 9, 2026
## 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>
ans9868 pushed a commit to ans9868/ray that referenced this pull request Feb 18, 2026
)

## 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>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
)

## 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>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
)

## 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>
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 data Ray Data-related issues deprecation Scheduled for deprecation docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Data] Deprecate V1 cluster autoscaler in favor of V2

3 participants