anyscale 0.26.31__py3-none-any.whl → 0.26.32__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.
- anyscale/_private/anyscale_client/anyscale_client.py +15 -0
- anyscale/_private/anyscale_client/common.py +12 -1
- anyscale/_private/anyscale_client/fake_anyscale_client.py +24 -0
- anyscale/_private/docgen/__main__.py +2 -0
- anyscale/_private/docgen/models.md +2 -2
- anyscale/client/README.md +7 -0
- anyscale/client/openapi_client/__init__.py +6 -0
- anyscale/client/openapi_client/api/default_api.py +114 -0
- anyscale/client/openapi_client/models/__init__.py +6 -0
- anyscale/client/openapi_client/models/baseimagesenum.py +68 -1
- anyscale/client/openapi_client/models/cluster_operation.py +266 -0
- anyscale/client/openapi_client/models/cluster_operation_type.py +101 -0
- anyscale/client/openapi_client/models/clusteroperation_response.py +121 -0
- anyscale/client/openapi_client/models/operation_error.py +123 -0
- anyscale/client/openapi_client/models/operation_progress.py +123 -0
- anyscale/client/openapi_client/models/operation_result.py +150 -0
- anyscale/client/openapi_client/models/supportedbaseimagesenum.py +68 -1
- anyscale/cloud/__init__.py +16 -0
- anyscale/cloud/_private/cloud_sdk.py +33 -0
- anyscale/cloud/commands.py +35 -0
- anyscale/commands/cloud_commands.py +35 -0
- anyscale/commands/command_examples.py +6 -0
- anyscale/sdk/anyscale_client/models/baseimagesenum.py +68 -1
- anyscale/sdk/anyscale_client/models/supportedbaseimagesenum.py +68 -1
- anyscale/shared_anyscale_utils/latest_ray_version.py +1 -1
- anyscale/version.py +1 -1
- {anyscale-0.26.31.dist-info → anyscale-0.26.32.dist-info}/METADATA +1 -1
- {anyscale-0.26.31.dist-info → anyscale-0.26.32.dist-info}/RECORD +33 -27
- {anyscale-0.26.31.dist-info → anyscale-0.26.32.dist-info}/LICENSE +0 -0
- {anyscale-0.26.31.dist-info → anyscale-0.26.32.dist-info}/NOTICE +0 -0
- {anyscale-0.26.31.dist-info → anyscale-0.26.32.dist-info}/WHEEL +0 -0
- {anyscale-0.26.31.dist-info → anyscale-0.26.32.dist-info}/entry_points.txt +0 -0
- {anyscale-0.26.31.dist-info → anyscale-0.26.32.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,7 @@
|
|
1
1
|
from typing import List, Optional
|
2
2
|
|
3
3
|
from anyscale._private.sdk.base_sdk import BaseSDK
|
4
|
+
from anyscale.cli_logger import BlockLogger
|
4
5
|
from anyscale.client.openapi_client.models import (
|
5
6
|
Cloud as CloudModel,
|
6
7
|
CreateCloudCollaborator as CreateCloudCollaboratorModel,
|
@@ -11,6 +12,10 @@ from anyscale.cloud.models import (
|
|
11
12
|
ComputeStack,
|
12
13
|
CreateCloudCollaborator,
|
13
14
|
)
|
15
|
+
from anyscale.sdk.anyscale_client.models import ClusterState
|
16
|
+
|
17
|
+
|
18
|
+
logger = BlockLogger()
|
14
19
|
|
15
20
|
|
16
21
|
class PrivateCloudSDK(BaseSDK):
|
@@ -80,3 +85,31 @@ class PrivateCloudSDK(BaseSDK):
|
|
80
85
|
is_default=openapi_cloud.is_default,
|
81
86
|
compute_stack=compute_stack,
|
82
87
|
)
|
88
|
+
|
89
|
+
def terminate_system_cluster(self, cloud_id: str, wait: bool) -> str:
|
90
|
+
resp = self.client.terminate_system_cluster(cloud_id)
|
91
|
+
if wait:
|
92
|
+
self._wait_for_system_cluster_status(cloud_id, ClusterState.TERMINATED)
|
93
|
+
else:
|
94
|
+
logger.info(f"System cluster termination initiated for cloud {cloud_id}.")
|
95
|
+
return resp.result.cluster_id
|
96
|
+
|
97
|
+
def _wait_for_system_cluster_status(
|
98
|
+
self,
|
99
|
+
cloud_id: str,
|
100
|
+
goal_status: str,
|
101
|
+
timeout_s: int = 500,
|
102
|
+
interval_s: int = 10,
|
103
|
+
) -> bool:
|
104
|
+
self.logger.info("Waiting for system cluster termination...", end="")
|
105
|
+
for _ in self.timer.poll(timeout_s=timeout_s, interval_s=interval_s):
|
106
|
+
status = self.client.describe_system_workload_get_status(cloud_id)
|
107
|
+
if status == goal_status:
|
108
|
+
print(".")
|
109
|
+
self.logger.info(f"System cluster for cloud '{cloud_id}' is {status}.")
|
110
|
+
return True
|
111
|
+
else:
|
112
|
+
print(".", end="")
|
113
|
+
raise TimeoutError(
|
114
|
+
f"Timed out waiting for system cluster termination for cloud '{cloud_id}'. Last seen status: {status}."
|
115
|
+
)
|
anyscale/cloud/commands.py
CHANGED
@@ -114,3 +114,38 @@ def get_default(*, _private_sdk: Optional[PrivateCloudSDK] = None) -> Optional[C
|
|
114
114
|
:return: The default `Cloud` object if it exists, otherwise `None`.
|
115
115
|
"""
|
116
116
|
return _private_sdk.get_default() # type: ignore
|
117
|
+
|
118
|
+
|
119
|
+
_TERMINATE_SYSTEM_CLUSTER_EXAMPLE = """
|
120
|
+
import anyscale
|
121
|
+
|
122
|
+
# Terminate the system cluster for the cloud with the specified ID
|
123
|
+
anyscale.cloud.terminate_system_cluster(cloud_id="cloud_id", wait=True)
|
124
|
+
"""
|
125
|
+
|
126
|
+
_TERMINATE_SYSTEM_CLUSTER_ARG_DOCSTRINGS = {
|
127
|
+
"cloud_id": "The ID of the cloud whose system cluster should be terminated.",
|
128
|
+
"wait": "If True, wait for the system cluster to be terminated before returning. Defaults to False.",
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
@sdk_command(
|
133
|
+
_CLOUD_SDK_SINGLETON_KEY,
|
134
|
+
PrivateCloudSDK,
|
135
|
+
doc_py_example=_TERMINATE_SYSTEM_CLUSTER_EXAMPLE,
|
136
|
+
arg_docstrings=_TERMINATE_SYSTEM_CLUSTER_ARG_DOCSTRINGS,
|
137
|
+
)
|
138
|
+
def terminate_system_cluster(
|
139
|
+
cloud_id: str,
|
140
|
+
wait: Optional[bool] = False,
|
141
|
+
*,
|
142
|
+
_private_sdk: Optional[PrivateCloudSDK] = None,
|
143
|
+
) -> str:
|
144
|
+
"""
|
145
|
+
Terminate the system cluster for the specified cloud.
|
146
|
+
|
147
|
+
:param cloud: The name of the cloud whose system cluster should be terminated.
|
148
|
+
:param wait: If True, wait for the system cluster to be terminated before returning. Defaults to False.
|
149
|
+
:return: ID of the terminated system cluster.
|
150
|
+
"""
|
151
|
+
return _private_sdk.terminate_system_cluster(cloud_id, wait) # type: ignore
|
@@ -1269,3 +1269,38 @@ def generate_jobs_report(
|
|
1269
1269
|
)
|
1270
1270
|
except ValueError as e:
|
1271
1271
|
log.error(f"Error generating jobs report: {e}")
|
1272
|
+
|
1273
|
+
|
1274
|
+
@cloud_cli.command(
|
1275
|
+
name="terminate-system-cluster",
|
1276
|
+
help="Terminate the system cluster for a specific given cloud.",
|
1277
|
+
cls=AnyscaleCommand,
|
1278
|
+
example=command_examples.CLOUD_TERMINATE_SYSTEM_CLUSTER_EXAMPLE,
|
1279
|
+
)
|
1280
|
+
@click.option(
|
1281
|
+
"--cloud-id",
|
1282
|
+
"--id",
|
1283
|
+
help="ID of the cloud to terminate the system cluster for.",
|
1284
|
+
type=str,
|
1285
|
+
required=True,
|
1286
|
+
)
|
1287
|
+
@click.option(
|
1288
|
+
"-w",
|
1289
|
+
"--wait",
|
1290
|
+
required=False,
|
1291
|
+
default=False,
|
1292
|
+
type=bool,
|
1293
|
+
is_flag=True,
|
1294
|
+
help="Block this CLI command and print logs until the job finishes.",
|
1295
|
+
)
|
1296
|
+
def terminate_system_cluster(cloud_id: str, wait: Optional[bool]) -> None:
|
1297
|
+
"""
|
1298
|
+
Terminate the system cluster for a specific cloud.
|
1299
|
+
|
1300
|
+
:param cloud_id: The ID of the cloud to terminate the system cluster for.
|
1301
|
+
:param wait: If True, wait for the system cluster to be terminated before returning. Defaults to False.
|
1302
|
+
"""
|
1303
|
+
try:
|
1304
|
+
anyscale.cloud.terminate_system_cluster(cloud_id, wait)
|
1305
|
+
except ValueError as e:
|
1306
|
+
log.error(f"Error terminating system cluster: {e}")
|
@@ -673,6 +673,12 @@ is_default: true
|
|
673
673
|
compute_stack: VM
|
674
674
|
"""
|
675
675
|
|
676
|
+
CLOUD_TERMINATE_SYSTEM_CLUSTER_EXAMPLE = """\
|
677
|
+
$ anyscale cloud terminate-system-cluster --cloud-id cloud_id --wait
|
678
|
+
(anyscale +1.3s) Waiting for system cluster termination............
|
679
|
+
(anyscale +1m22.9s) System cluster for cloud 'cloud_id' is Terminated.
|
680
|
+
"""
|
681
|
+
|
676
682
|
SERVICE_ARCHIVE_EXAMPLE = """\
|
677
683
|
$ anyscale service archive --name my_service
|
678
684
|
"""
|