Skip to content

Commit f4ce684

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: add support for version 2.42 for RoV Bigquery read/write
PiperOrigin-RevId: 738125614
1 parent a6b7de5 commit f4ce684

File tree

4 files changed

+32
-31
lines changed

4 files changed

+32
-31
lines changed

google/cloud/aiplatform/vertex_ray/bigquery_datasink.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
)
5252

5353

54-
# BigQuery write for Ray 2.33.0 and 2.9.3
54+
# BigQuery write for Ray 2.42.0, 2.33.0, and 2.9.3
5555
if Datasink is None:
5656
_BigQueryDatasink = None
5757
else:

google/cloud/aiplatform/vertex_ray/data.py

+24-25
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,25 @@ def read_bigquery(
5757
dataset: The name of the dataset hosted in BigQuery in the format of
5858
``dataset_id.table_id``. Both the dataset_id and table_id must exist
5959
otherwise an exception will be raised.
60-
query: The query to execute.
61-
The dataset is created from the results of executing the query if provided.
62-
Otherwise, the entire dataset is read. For query syntax guidelines, see
60+
query: The query to execute. The dataset is created from the results of
61+
executing the query if provided. Otherwise, the entire dataset is read.
62+
For query syntax guidelines, see
6363
https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax
64-
parallelism:
65-
2.9.3: The requested parallelism of the read. If -1, it will be
66-
automatically chosen based on the available cluster resources
67-
and estimated in-memory data size.
68-
2.33.0: This argument is deprecated. Use ``override_num_blocks`` argument.
64+
parallelism: 2.33.0, 2.42.0: This argument is deprecated. Use
65+
``override_num_blocks`` argument. 2.9.3: The requested parallelism of
66+
the read. If -1, it will be automatically chosen based on the available
67+
cluster resources and estimated in-memory data size.
6968
ray_remote_args: kwargs passed to ray.remote in the read tasks.
70-
concurrency: Not supported in 2.9.3.
71-
2.33.0: The maximum number of Ray tasks to run concurrently. Set this
72-
to control number of tasks to run concurrently. This doesn't change the
73-
total number of tasks run or the total number of output blocks. By default,
74-
concurrency is dynamically decided based on the available resources.
75-
override_num_blocks: Not supported in 2.9.3.
76-
2.33.0: Override the number of output blocks from all read tasks.
77-
By default, the number of output blocks is dynamically decided based on
78-
input data size and available resources. You shouldn't manually set this
79-
value in most cases.
69+
concurrency: Supported for 2.33.0 and 2.42.0 only: The maximum number of
70+
Ray tasks to run concurrently. Set this to control number of tasks to
71+
run concurrently. This doesn't change the total number of tasks run or
72+
the total number of output blocks. By default, concurrency is
73+
dynamically decided based on the available resources.
74+
override_num_blocks: Supported for 2.33.0 and 2.42.0 only: Override the
75+
number of output blocks from all read tasks. By default, the number of
76+
output blocks is dynamically decided based on input data size and
77+
available resources. You shouldn't manually set this value in most
78+
cases.
8079
8180
Returns:
8281
Dataset producing rows from the results of executing the query
@@ -96,7 +95,7 @@ def read_bigquery(
9695
parallelism=parallelism,
9796
ray_remote_args=ray_remote_args,
9897
)
99-
elif ray.__version__ == "2.33.0":
98+
elif ray.__version__ in ("2.33.0", "2.42.0"):
10099
return ray.data.read_datasource(
101100
datasource=datasource,
102101
parallelism=parallelism,
@@ -107,7 +106,7 @@ def read_bigquery(
107106
else:
108107
raise ImportError(
109108
f"[Ray on Vertex AI]: Unsupported version {ray.__version__}."
110-
+ "Only 2.33.0 and 2.9.3 are supported."
109+
+ "Only 2.42.0, 2.33.0, and 2.9.3 are supported."
111110
)
112111

113112

@@ -135,19 +134,19 @@ def write_bigquery(
135134
The default number of retries is 10.
136135
ray_remote_args: kwargs passed to ray.remote in the write tasks.
137136
overwrite_table: Not supported in 2.9.3.
138-
2.33.0: Whether the write will overwrite the table if it already
137+
2.33.0, 2.42.0: Whether the write will overwrite the table if it already
139138
exists. The default behavior is to overwrite the table.
140139
If false, will append to the table if it exists.
141140
concurrency: Not supported in 2.9.3.
142-
2.33.0: The maximum number of Ray tasks to run concurrently. Set this
141+
2.33.0, 2.42.0: The maximum number of Ray tasks to run concurrently. Set this
143142
to control number of tasks to run concurrently. This doesn't change the
144143
total number of tasks run or the total number of output blocks. By default,
145144
concurrency is dynamically decided based on the available resources.
146145
"""
147146
if ray.__version__ == "2.4.0":
148147
raise RuntimeError(_V2_4_WARNING_MESSAGE)
149148

150-
elif ray.__version__ == "2.9.3" or ray.__version__ == "2.33.0":
149+
elif ray.__version__ in ("2.9.3", "2.33.0", "2.42.0"):
151150
if ray.__version__ == "2.9.3":
152151
warnings.warn(_V2_9_WARNING_MESSAGE, DeprecationWarning, stacklevel=1)
153152
if ray_remote_args is None:
@@ -174,7 +173,7 @@ def write_bigquery(
174173
datasink=datasink,
175174
ray_remote_args=ray_remote_args,
176175
)
177-
elif ray.__version__ == "2.33.0":
176+
elif ray.__version__ in ("2.33.0", "2.42.0"):
178177
datasink = _BigQueryDatasink(
179178
project_id=project_id,
180179
dataset=dataset,
@@ -189,5 +188,5 @@ def write_bigquery(
189188
else:
190189
raise ImportError(
191190
f"[Ray on Vertex AI]: Unsupported version {ray.__version__}."
192-
+ "Only 2.33.0 and 2.9.3 are supported."
191+
+ "Only 2.42.0, 2.33.0 and 2.9.3 are supported."
193192
)

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@
2525
from google.cloud.aiplatform import initializer
2626
from google.cloud.aiplatform.utils import resource_manager_utils
2727

28-
SUPPORTED_RAY_VERSIONS = immutabledict({"2.9": "2.9.3", "2.33": "2.33.0"})
28+
SUPPORTED_RAY_VERSIONS = immutabledict(
29+
{"2.9": "2.9.3", "2.33": "2.33.0", "2.42": "2.42.0"}
30+
)
2931
SUPPORTED_PY_VERSION = ["3.10"]
3032
_V2_4_WARNING_MESSAGE = (
31-
"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)."
33+
"After google-cloud-aiplatform>1.53.0, using Ray version = 2.4 will result"
34+
" in an error. Please use Ray version = 2.33.0 or 2.42.0 (default) instead."
3335
)
3436
_V2_9_WARNING_MESSAGE = (
3537
"In March 2025, using Ray version = 2.9 will result in an error. "
36-
"Please use Ray version = 2.33.0 (default) instead."
38+
"Please use Ray version = 2.33.0 or 2.42.0 (default) instead."
3739
)
3840

3941

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)."
57+
" in an error. Please use Ray version = 2.33.0 or 2.42.0 (default) instead."
5858
)
5959

6060

0 commit comments

Comments
 (0)