anyscale 0.26.30__py3-none-any.whl → 0.26.31__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,6 +68,7 @@ from anyscale.client.openapi_client.models import (
68
68
  ExperimentalWorkspace,
69
69
  FineTunedModel,
70
70
  FinetunedmodelListResponse,
71
+ GetOrCreateBuildFromImageUriRequest,
71
72
  InternalProductionJob,
72
73
  JobQueueSortDirective,
73
74
  JobQueuesQuery,
@@ -946,69 +947,15 @@ class AnyscaleClient(AnyscaleClientInterface):
946
947
  ray_version: Optional[str] = None,
947
948
  name: Optional[str] = None,
948
949
  ) -> str:
949
- if image_uri.is_cluster_env_image():
950
- identifier = image_uri.to_cluster_env_identifier()
951
- try:
952
- build = self._external_api_client.find_cluster_environment_build_by_identifier(
953
- identifier=identifier
954
- ).result
955
- if build.status == ClusterEnvironmentBuildStatus.SUCCEEDED:
956
- return build.id
957
- else:
958
- raise RuntimeError(
959
- f"Legacy cluster environment build '{identifier}' is not a successful build."
960
- )
961
- except ExternalApiException as e:
962
- if e.status == 404:
963
- raise RuntimeError(
964
- f"Legacy cluster environment '{identifier}' is not found."
965
- )
966
- elif image_uri.is_default_image():
967
- # Default image
968
- cluster_envs = self._internal_api_client.list_application_templates_api_v2_application_templates_get(
969
- image_name_contains=image_uri.image_uri
970
- ).results
971
- for cluster_env in cluster_envs:
972
- if (
973
- cluster_env.latest_build is not None
974
- and cluster_env.latest_build.docker_image_name
975
- == image_uri.image_uri
976
- ):
977
- return cluster_env.latest_build.id
978
- raise RuntimeError(f"Default image '{image_uri.image_uri}' is not found.")
979
-
980
- # BYOD image
981
- cluster_env_name = name if name else image_uri.to_cluster_env_name()
982
- image_uri_str = str(image_uri)
983
- cluster_env = self._find_or_create_cluster_env(
984
- cluster_env_name,
985
- anonymous=not name,
986
- image_uri=image_uri_str,
987
- registry_login_secret=registry_login_secret,
988
- ray_version=ray_version,
989
- )
990
- for build in self.list_cluster_env_builds(cluster_env.id):
991
- if (
992
- # NOTE: Ignore ray version mismatch for now. We plan to eventually remove ray version from the API model.
993
- build.docker_image_name == image_uri_str
994
- and build.registry_login_secret == registry_login_secret
995
- and build.status == ClusterEnvironmentBuildStatus.SUCCEEDED
996
- ):
997
- return build.id
998
-
999
- # Still create a new build if the cluster env already exists but the build does not match the image_uri.
1000
- result = self._external_api_client.create_cluster_environment_build(
1001
- CreateClusterEnvironmentBuild(
1002
- # For historical reasons, we have to use docker_image_name instead of image_uri; but it is just a URI to the image.
1003
- cluster_environment_id=cluster_env.id,
1004
- docker_image_name=image_uri_str,
950
+ build = self._internal_api_client.get_or_create_build_from_image_uri_api_v2_builds_get_or_create_build_from_image_uri_post(
951
+ GetOrCreateBuildFromImageUriRequest(
952
+ image_uri=str(image_uri),
1005
953
  registry_login_secret=registry_login_secret,
1006
- ray_version=ray_version if ray_version else LATEST_RAY_VERSION,
954
+ ray_version=ray_version,
955
+ cluster_env_name=name,
1007
956
  )
1008
957
  ).result
1009
-
1010
- assert result.completed
1011
- return result.cluster_environment_build_id
958
+ return build.id
1012
959
 
1013
960
  @handle_api_exceptions
1014
961
  def send_workspace_notification(
@@ -54,7 +54,7 @@ from anyscale.utils.workspace_notification import WorkspaceNotification
54
54
  # Maybe just make it part of the release process to update it, or fetch the
55
55
  # default builds and get the latest one. The best thing to do is probably
56
56
  # to populate this in the backend.
57
- DEFAULT_RAY_VERSION = "2.46.0" # RAY_RELEASE_UPDATE: update to latest version.
57
+ DEFAULT_RAY_VERSION = "2.47.0" # RAY_RELEASE_UPDATE: update to latest version.
58
58
  DEFAULT_PYTHON_VERSION = "py311"
59
59
  RUNTIME_ENV_PACKAGE_FORMAT = "pkg_{content_hash}.zip"
60
60