Skip to content

Commit

Permalink
feat: Release Ray on Vertex SDK to GA
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 632239389
  • Loading branch information
matthew29tang authored and copybara-github committed May 9, 2024
1 parent c528b6f commit f7c5132
Show file tree
Hide file tree
Showing 41 changed files with 226 additions and 48 deletions.
12 changes: 6 additions & 6 deletions google/cloud/aiplatform/preview/vertex_ray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@
#
import sys

from google.cloud.aiplatform.preview.vertex_ray.bigquery_datasource import (
from google.cloud.aiplatform.vertex_ray.bigquery_datasource import (
BigQueryDatasource,
)
from google.cloud.aiplatform.preview.vertex_ray.client_builder import (
from google.cloud.aiplatform.vertex_ray.client_builder import (
VertexRayClientBuilder as ClientBuilder,
)

from google.cloud.aiplatform.preview.vertex_ray.cluster_init import (
from google.cloud.aiplatform.vertex_ray.cluster_init import (
create_ray_cluster,
delete_ray_cluster,
get_ray_cluster,
list_ray_clusters,
update_ray_cluster,
)

from google.cloud.aiplatform.preview.vertex_ray import data
from google.cloud.aiplatform.vertex_ray import data

from google.cloud.aiplatform.preview.vertex_ray.util.resources import (
from google.cloud.aiplatform.vertex_ray.util.resources import (
Resources,
NodeImages,
)

from google.cloud.aiplatform.preview.vertex_ray.dashboard_sdk import (
from google.cloud.aiplatform.vertex_ray.dashboard_sdk import (
get_job_submission_client_cluster_info,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# limitations under the License.
#

from .register import register_sklearn
from google.cloud.aiplatform.vertex_ray.predict.sklearn import (
register_sklearn,
)

__all__ = ("register_sklearn",)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# limitations under the License.
#

from .register import register_tensorflow
from google.cloud.aiplatform.vertex_ray.predict.tensorflow import (
register_tensorflow,
)

__all__ = ("register_tensorflow",)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# limitations under the License.
#

from .register import get_pytorch_model_from
from google.cloud.aiplatform.vertex_ray.predict.torch import (
get_pytorch_model_from,
)

__all__ = ("get_pytorch_model_from",)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# limitations under the License.
#

from .register import register_xgboost
from google.cloud.aiplatform.vertex_ray.predict.xgboost import (
register_xgboost,
)

__all__ = ("register_xgboost",)
64 changes: 64 additions & 0 deletions google/cloud/aiplatform/vertex_ray/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""Ray on Vertex AI."""

# -*- coding: utf-8 -*-

# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import sys

from google.cloud.aiplatform.vertex_ray.bigquery_datasource import (
BigQueryDatasource,
)
from google.cloud.aiplatform.vertex_ray.client_builder import (
VertexRayClientBuilder as ClientBuilder,
)

from google.cloud.aiplatform.vertex_ray.cluster_init import (
create_ray_cluster,
delete_ray_cluster,
get_ray_cluster,
list_ray_clusters,
update_ray_cluster,
)

from google.cloud.aiplatform.vertex_ray import data

from google.cloud.aiplatform.vertex_ray.util.resources import (
Resources,
NodeImages,
)

from google.cloud.aiplatform.vertex_ray.dashboard_sdk import (
get_job_submission_client_cluster_info,
)

if sys.version_info[1] != 10:
print(
"[Ray on Vertex]: The client environment with Python version 3.10 is required."
)

__all__ = (
"BigQueryDatasource",
"data",
"ClientBuilder",
"get_job_submission_client_cluster_info",
"create_ray_cluster",
"delete_ray_cluster",
"get_ray_cluster",
"list_ray_clusters",
"update_ray_cluster",
"Resources",
"NodeImages",
)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
ServiceAccountSpec,
)

from google.cloud.aiplatform.preview.vertex_ray.util import (
from google.cloud.aiplatform.vertex_ray.util import (
_gapic_utils,
_validation_utils,
resources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
from typing import Any, Dict, Optional
import warnings

from google.cloud.aiplatform.preview.vertex_ray.bigquery_datasource import (
from google.cloud.aiplatform.vertex_ray.bigquery_datasource import (
BigQueryDatasource,
)

try:
from google.cloud.aiplatform.preview.vertex_ray.bigquery_datasink import (
from google.cloud.aiplatform.vertex_ray.bigquery_datasink import (
_BigQueryDatasink,
)
except ImportError:
_BigQueryDatasink = None

from google.cloud.aiplatform.preview.vertex_ray.util._validation_utils import (
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
_V2_4_WARNING_MESSAGE,
)

Expand Down
18 changes: 18 additions & 0 deletions google/cloud/aiplatform/vertex_ray/predict/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Ray on Vertex AI Prediction."""

# -*- coding: utf-8 -*-

# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
22 changes: 22 additions & 0 deletions google/cloud/aiplatform/vertex_ray/predict/sklearn/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Ray on Vertex AI Prediction Tensorflow."""

# -*- coding: utf-8 -*-

# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .register import register_sklearn

__all__ = ("register_sklearn",)
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
from google.cloud.aiplatform import initializer
from google.cloud.aiplatform import utils
from google.cloud.aiplatform.utils import gcs_utils
from google.cloud.aiplatform.preview.vertex_ray.predict.util import constants
from google.cloud.aiplatform.preview.vertex_ray.predict.util import (
from google.cloud.aiplatform.vertex_ray.predict.util import constants
from google.cloud.aiplatform.vertex_ray.predict.util import (
predict_utils,
)
from google.cloud.aiplatform.preview.vertex_ray.util._validation_utils import (
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
_V2_4_WARNING_MESSAGE,
)

Expand Down
22 changes: 22 additions & 0 deletions google/cloud/aiplatform/vertex_ray/predict/tensorflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Ray on Vertex AI Prediction Tensorflow."""

# -*- coding: utf-8 -*-

# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .register import register_tensorflow

__all__ = ("register_tensorflow",)
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
from google.cloud import aiplatform
from google.cloud.aiplatform import initializer
from google.cloud.aiplatform import utils
from google.cloud.aiplatform.preview.vertex_ray.predict.util import constants
from google.cloud.aiplatform.preview.vertex_ray.predict.util import (
from google.cloud.aiplatform.vertex_ray.predict.util import constants
from google.cloud.aiplatform.vertex_ray.predict.util import (
predict_utils,
)
from google.cloud.aiplatform.preview.vertex_ray.util._validation_utils import (
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
_V2_4_WARNING_MESSAGE,
)

Expand Down
22 changes: 22 additions & 0 deletions google/cloud/aiplatform/vertex_ray/predict/torch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Ray on Vertex AI Prediction Tensorflow."""

# -*- coding: utf-8 -*-

# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .register import get_pytorch_model_from

__all__ = ("get_pytorch_model_from",)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import ray
from ray.air._internal.torch_utils import load_torch_model
import tempfile
from google.cloud.aiplatform.preview.vertex_ray.util._validation_utils import (
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
_V2_4_WARNING_MESSAGE,
)
from google.cloud.aiplatform.utils import gcs_utils
Expand Down
22 changes: 22 additions & 0 deletions google/cloud/aiplatform/vertex_ray/predict/xgboost/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Ray on Vertex AI Prediction Tensorflow."""

# -*- coding: utf-8 -*-

# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .register import register_xgboost

__all__ = ("register_xgboost",)
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
from google.cloud.aiplatform import initializer
from google.cloud.aiplatform import utils
from google.cloud.aiplatform.utils import gcs_utils
from google.cloud.aiplatform.preview.vertex_ray.predict.util import constants
from google.cloud.aiplatform.preview.vertex_ray.predict.util import (
from google.cloud.aiplatform.vertex_ray.predict.util import constants
from google.cloud.aiplatform.vertex_ray.predict.util import (
predict_utils,
)
from google.cloud.aiplatform.preview.vertex_ray.util._validation_utils import (
from google.cloud.aiplatform.vertex_ray.util._validation_utils import (
_V2_4_WARNING_MESSAGE,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from google.cloud.aiplatform.utils import (
PersistentResourceClientWithOverride,
)
from google.cloud.aiplatform.preview.vertex_ray.util import _validation_utils
from google.cloud.aiplatform.preview.vertex_ray.util.resources import (
from google.cloud.aiplatform.vertex_ray.util import _validation_utils
from google.cloud.aiplatform.vertex_ray.util.resources import (
Cluster,
Resources,
)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

# Add vertex_ray relative packages
packages += [
package.replace("google.cloud.aiplatform.preview.vertex_ray", "vertex_ray")
package.replace("google.cloud.aiplatform.vertex_ray", "vertex_ray")
for package in setuptools.PEP420PackageFinder.find()
if package.startswith("google.cloud.aiplatform.preview.vertex_ray")
if package.startswith("google.cloud.aiplatform.vertex_ray")
]

tensorboard_extra_require = ["tensorflow >=2.3.0, <3.0.0dev; python_version<='3.11'"]
Expand Down Expand Up @@ -215,7 +215,7 @@
description=description,
long_description=readme,
packages=packages,
package_dir={"vertex_ray": "google/cloud/aiplatform/preview/vertex_ray"},
package_dir={"vertex_ray": "google/cloud/aiplatform/vertex_ray"},
package_data={"": ["*.html.j2"]},
entry_points={
"console_scripts": [
Expand Down
2 changes: 1 addition & 1 deletion tests/system/vertex_ray/test_cluster_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from google.cloud import aiplatform
from google.cloud.aiplatform.preview import vertex_ray
from google.cloud.aiplatform import vertex_ray
from tests.system.aiplatform import e2e_base
import datetime
import pytest
Expand Down
4 changes: 2 additions & 2 deletions tests/system/vertex_ray/test_job_submission_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from google.cloud import aiplatform
from google.cloud.aiplatform.preview import vertex_ray
from google.cloud.aiplatform import vertex_ray
from ray.job_submission import JobSubmissionClient
from tests.system.aiplatform import e2e_base
import datetime
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_job_submission_dashboard(self, cluster_ray_version):

# Need to use the full path since the installation is editable, not from a release
client = JobSubmissionClient(
"google.cloud.aiplatform.preview.vertex_ray://{}".format(
"google.cloud.aiplatform.vertex_ray://{}".format(
cluster_details.dashboard_address
)
)
Expand Down
Loading

0 comments on commit f7c5132

Please sign in to comment.