Skip to content

Commit 0ce106b

Browse files
yinghsienwucopybara-github
authored andcommitted
fix: Add deprecation warning to Ray version 2.9.3
PiperOrigin-RevId: 688252265
1 parent 3e7bf81 commit 0ce106b

File tree

11 files changed

+37
-12
lines changed

11 files changed

+37
-12
lines changed

.kokoro/release.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /
2323
export PYTHONUNBUFFERED=1
2424

2525
# Move into the `google-cloud-aiplatform` package, build the distribution and upload.
26-
GCA_TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-2")
26+
GCA_TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-3")
2727
cd github/python-aiplatform
2828
python3 setup.py sdist bdist_wheel
2929
twine upload --username __token__ --password "${GCA_TWINE_PASSWORD}" dist/*
3030

3131
# Move into the `vertexai` package, build the distribution and upload.
32-
VERTEXAI_TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_vertexai-pypi-token-1")
32+
VERTEXAI_TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_vertexai-pypi-token-2")
3333
cd pypi/_vertex_ai_placeholder
3434
python3 -m build
3535
twine upload --username __token__ --password "${VERTEXAI_TWINE_PASSWORD}" dist/*

.kokoro/release/common.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ before_action {
2828
fetch_keystore {
2929
keystore_resource {
3030
keystore_config_id: 73713
31-
keyname: "google-cloud-pypi-token-keystore-2"
31+
keyname: "google-cloud-pypi-token-keystore-3"
3232
}
3333
}
3434
}
@@ -38,7 +38,7 @@ before_action {
3838
fetch_keystore {
3939
keystore_resource {
4040
keystore_config_id: 73713
41-
keyname: "vertexai-pypi-token-1"
41+
keyname: "vertexai-pypi-token-2"
4242
}
4343
}
4444
}

google/cloud/aiplatform/vertex_ray/cluster_init.py

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import logging
2020
import time
2121
from typing import Dict, List, Optional
22+
import warnings
2223

2324
from google.cloud.aiplatform import initializer
2425
from google.cloud.aiplatform import utils
@@ -46,6 +47,7 @@
4647
from google.protobuf import field_mask_pb2 # type: ignore
4748
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
4849
_V2_4_WARNING_MESSAGE,
50+
_V2_9_WARNING_MESSAGE,
4951
)
5052

5153

@@ -154,6 +156,8 @@ def create_ray_cluster(
154156
)
155157
if ray_version == "2.4":
156158
raise RuntimeError(_V2_4_WARNING_MESSAGE)
159+
if ray_version == "2.9.3":
160+
warnings.warn(_V2_9_WARNING_MESSAGE, DeprecationWarning, stacklevel=1)
157161
local_ray_verion = _validation_utils.get_local_ray_version()
158162
if ray_version != local_ray_verion:
159163
if custom_images is None and head_node_type.custom_image is None:

google/cloud/aiplatform/vertex_ray/data.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17-
17+
import warnings
1818
import ray.data
1919
from ray.data.dataset import Dataset
2020
from typing import Any, Dict, Optional
@@ -32,6 +32,7 @@
3232

3333
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
3434
_V2_4_WARNING_MESSAGE,
35+
_V2_9_WARNING_MESSAGE,
3536
)
3637

3738

@@ -88,6 +89,7 @@ def read_bigquery(
8889
)
8990

9091
if ray.__version__ == "2.9.3":
92+
warnings.warn(_V2_9_WARNING_MESSAGE, DeprecationWarning, stacklevel=1)
9193
# Concurrency and override_num_blocks are not supported in 2.9.3
9294
return ray.data.read_datasource(
9395
datasource=datasource,
@@ -146,6 +148,8 @@ def write_bigquery(
146148
raise RuntimeError(_V2_4_WARNING_MESSAGE)
147149

148150
elif ray.__version__ == "2.9.3" or ray.__version__ == "2.33.0":
151+
if ray.__version__ == "2.9.3":
152+
warnings.warn(_V2_9_WARNING_MESSAGE, DeprecationWarning, stacklevel=1)
149153
if ray_remote_args is None:
150154
ray_remote_args = {}
151155

google/cloud/aiplatform/vertex_ray/predict/sklearn/register.py

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import os
2121
import pickle
22+
import warnings
2223
import ray
2324
import ray.cloudpickle as cpickle
2425
import tempfile
@@ -34,6 +35,7 @@
3435
)
3536
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
3637
_V2_4_WARNING_MESSAGE,
38+
_V2_9_WARNING_MESSAGE,
3739
)
3840

3941

@@ -94,6 +96,8 @@ def register_sklearn(
9496
f"Ray version {ray_version} is not supported to upload Sklearn"
9597
" model to Vertex Model Registry yet. Please use Ray 2.9.3."
9698
)
99+
if ray_version == "2.9.3":
100+
warnings.warn(_V2_9_WARNING_MESSAGE, DeprecationWarning, stacklevel=1)
97101

98102
artifact_uri = artifact_uri or initializer.global_config.staging_bucket
99103
predict_utils.validate_artifact_uri(artifact_uri)

google/cloud/aiplatform/vertex_ray/predict/tensorflow/register.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import logging
2121
import ray
2222
from typing import Callable, Optional, Union, TYPE_CHECKING
23-
23+
import warnings
2424
from google.cloud import aiplatform
2525
from google.cloud.aiplatform import initializer
2626
from google.cloud.aiplatform import utils
@@ -30,6 +30,7 @@
3030
)
3131
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
3232
_V2_4_WARNING_MESSAGE,
33+
_V2_9_WARNING_MESSAGE,
3334
)
3435

3536

@@ -99,7 +100,8 @@ def create_model():
99100
Raises:
100101
ValueError: Invalid Argument.
101102
"""
102-
103+
if ray.__version__ == "2.9.3":
104+
warnings.warn(_V2_9_WARNING_MESSAGE, DeprecationWarning, stacklevel=1)
103105
if tensorflow_version is None:
104106
tensorflow_version = constants._TENSORFLOW_VERSION
105107
artifact_uri = artifact_uri or initializer.global_config.staging_bucket

google/cloud/aiplatform/vertex_ray/predict/torch/register.py

+4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
# limitations under the License.
1717

1818
import os
19+
import warnings
1920
import ray
2021
from ray.air._internal.torch_utils import load_torch_model
2122
import tempfile
2223
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
2324
_V2_4_WARNING_MESSAGE,
25+
_V2_9_WARNING_MESSAGE,
2426
)
2527
from google.cloud.aiplatform.utils import gcs_utils
2628
from typing import Optional
@@ -71,6 +73,8 @@ def get_pytorch_model_from(
7173
f"Ray on Vertex does not support Ray version {ray_version} to"
7274
" convert PyTorch model artifacts yet. Please use Ray 2.9.3."
7375
)
76+
if ray_version == "2.9.3":
77+
warnings.warn(_V2_9_WARNING_MESSAGE, DeprecationWarning, stacklevel=1)
7478

7579
try:
7680
return checkpoint.get_model()

google/cloud/aiplatform/vertex_ray/predict/xgboost/register.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import ray
2323
import tempfile
2424
from typing import Optional, TYPE_CHECKING
25-
25+
import warnings
2626
from google.cloud import aiplatform
2727
from google.cloud.aiplatform import initializer
2828
from google.cloud.aiplatform import utils
@@ -33,6 +33,7 @@
3333
)
3434
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
3535
_V2_4_WARNING_MESSAGE,
36+
_V2_9_WARNING_MESSAGE,
3637
)
3738

3839

@@ -102,7 +103,8 @@ def register_xgboost(
102103
f"Ray version {ray_version} is not supported to upload XGBoost"
103104
" model to Vertex Model Registry yet. Please use Ray 2.9.3."
104105
)
105-
106+
if ray_version == "2.9.3":
107+
warnings.warn(_V2_9_WARNING_MESSAGE, DeprecationWarning, stacklevel=1)
106108
artifact_uri = artifact_uri or initializer.global_config.staging_bucket
107109
predict_utils.validate_artifact_uri(artifact_uri)
108110
display_model_name = (

google/cloud/aiplatform/vertex_ray/util/_validation_utils.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@
2929
SUPPORTED_PY_VERSION = ["3.10"]
3030
_V2_4_WARNING_MESSAGE = (
3131
"After google-cloud-aiplatform>1.53.0, using Ray version = 2.4 will result in an error. "
32-
"Please use Ray version = 2.33.0 (default) or 2.9.3 instead."
32+
"Please use Ray version = 2.33.0 (default)."
3333
)
34+
_V2_9_WARNING_MESSAGE = (
35+
"In March 2025, using Ray version = 2.9 will result in an error. "
36+
"Please use Ray version = 2.33.0 (default) instead."
37+
)
38+
3439

3540
# Artifact Repository available regions.
3641
_AVAILABLE_REGIONS = ["us", "europe", "asia"]

testing/constraints-ray-2.9.3.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ grpcio-testing==1.34.0
1010
mlflow==1.30.1 # Pinned to speed up installation
1111
pytest-xdist==3.3.1 # Pinned to unbreak unit tests
1212
IPython # Added to test supernova rich html buttons
13-
13+
pandas==2.1.4 # Pandas must be <2.2.0 to be compatible with ray 2.9.3

tests/unit/vertex_ray/test_cluster_init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
_TEST_V2_4_WARNING_MESSAGE = (
5656
"After google-cloud-aiplatform>1.53.0, using Ray version = 2.4 will result"
57-
" in an error. Please use Ray version = 2.33.0 (default) or 2.9.3 instead."
57+
" in an error. Please use Ray version = 2.33.0 (default)."
5858
)
5959

6060

0 commit comments

Comments
 (0)