anyscale 0.26.51__py3-none-any.whl → 0.26.53__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/README.md +1 -1
- anyscale/_private/anyscale_client/anyscale_client.py +178 -46
- anyscale/_private/anyscale_client/common.py +61 -2
- anyscale/_private/anyscale_client/fake_anyscale_client.py +145 -8
- anyscale/_private/docgen/__main__.py +42 -31
- anyscale/_private/docgen/generator.py +63 -28
- anyscale/_private/docgen/models.md +4 -2
- anyscale/_private/sdk/__init__.py +124 -1
- anyscale/_private/workload/workload_config.py +4 -6
- anyscale/_private/workload/workload_sdk.py +105 -12
- anyscale/client/README.md +13 -11
- anyscale/client/openapi_client/__init__.py +3 -3
- anyscale/client/openapi_client/api/default_api.py +512 -316
- anyscale/client/openapi_client/models/__init__.py +3 -3
- anyscale/client/openapi_client/models/aws_config.py +2 -2
- anyscale/client/openapi_client/models/baseimagesenum.py +158 -1
- anyscale/client/openapi_client/models/cloud_data_bucket_presigned_url_request.py +31 -3
- anyscale/client/openapi_client/models/cloud_deployment.py +37 -36
- anyscale/client/openapi_client/models/cloud_resource.py +59 -3
- anyscale/client/openapi_client/models/cloud_resource_gcp.py +59 -3
- anyscale/client/openapi_client/models/create_cloud_resource.py +59 -3
- anyscale/client/openapi_client/models/create_cloud_resource_gcp.py +59 -3
- anyscale/client/openapi_client/models/create_resource_notification.py +31 -3
- anyscale/client/openapi_client/models/{decorated_cloud_deployment.py → decorated_cloud_resource.py} +124 -96
- anyscale/client/openapi_client/models/{clouddeployment_list_response.py → decoratedcloudresource_list_response.py} +15 -15
- anyscale/client/openapi_client/models/{decoratedclouddeployment_response.py → decoratedcloudresource_response.py} +11 -11
- anyscale/client/openapi_client/models/file_storage.py +4 -4
- anyscale/client/openapi_client/models/gcp_config.py +2 -2
- anyscale/client/openapi_client/models/ha_job_error_types.py +9 -2
- anyscale/client/openapi_client/models/object_storage.py +4 -4
- anyscale/client/openapi_client/models/ray_runtime_env_config.py +57 -1
- anyscale/client/openapi_client/models/resource_alert_event_type.py +2 -1
- anyscale/client/openapi_client/models/resource_notification.py +29 -1
- anyscale/client/openapi_client/models/supportedbaseimagesenum.py +155 -1
- anyscale/client/openapi_client/models/workload_info.py +31 -3
- anyscale/client/openapi_client/models/workload_state_info.py +29 -1
- anyscale/cloud/models.py +40 -43
- anyscale/commands/cloud_commands.py +93 -88
- anyscale/commands/command_examples.py +37 -49
- anyscale/commands/exec_commands.py +12 -1
- anyscale/commands/list_commands.py +42 -12
- anyscale/commands/project_commands.py +399 -115
- anyscale/commands/schedule_commands.py +22 -11
- anyscale/commands/service_commands.py +11 -6
- anyscale/commands/util.py +94 -1
- anyscale/commands/workspace_commands.py +92 -38
- anyscale/compute_config/__init__.py +1 -1
- anyscale/compute_config/_private/compute_config_sdk.py +8 -11
- anyscale/compute_config/commands.py +3 -3
- anyscale/compute_config/models.py +30 -30
- anyscale/controllers/cloud_controller.py +361 -360
- anyscale/controllers/kubernetes_verifier.py +1 -1
- anyscale/job/_private/job_sdk.py +41 -23
- anyscale/job/models.py +1 -1
- anyscale/project/__init__.py +101 -1
- anyscale/project/_private/project_sdk.py +90 -2
- anyscale/project/commands.py +188 -1
- anyscale/project/models.py +198 -2
- anyscale/sdk/anyscale_client/models/baseimagesenum.py +158 -1
- anyscale/sdk/anyscale_client/models/ray_runtime_env_config.py +57 -1
- anyscale/sdk/anyscale_client/models/supportedbaseimagesenum.py +155 -1
- anyscale/service/_private/service_sdk.py +2 -1
- anyscale/shared_anyscale_utils/latest_ray_version.py +1 -1
- anyscale/util.py +3 -0
- anyscale/utils/runtime_env.py +3 -1
- anyscale/version.py +1 -1
- anyscale/workspace/commands.py +114 -23
- anyscale/workspace/models.py +3 -5
- {anyscale-0.26.51.dist-info → anyscale-0.26.53.dist-info}/METADATA +1 -1
- {anyscale-0.26.51.dist-info → anyscale-0.26.53.dist-info}/RECORD +75 -75
- {anyscale-0.26.51.dist-info → anyscale-0.26.53.dist-info}/WHEEL +0 -0
- {anyscale-0.26.51.dist-info → anyscale-0.26.53.dist-info}/entry_points.txt +0 -0
- {anyscale-0.26.51.dist-info → anyscale-0.26.53.dist-info}/licenses/LICENSE +0 -0
- {anyscale-0.26.51.dist-info → anyscale-0.26.53.dist-info}/licenses/NOTICE +0 -0
- {anyscale-0.26.51.dist-info → anyscale-0.26.53.dist-info}/top_level.txt +0 -0
anyscale/project/models.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
|
2
|
-
from
|
1
|
+
import contextlib
|
2
|
+
from dataclasses import dataclass, field, fields
|
3
|
+
from datetime import datetime
|
4
|
+
import json
|
5
|
+
from typing import Any, Dict, List, Optional, Union
|
3
6
|
|
4
7
|
from anyscale._private.models import ModelBase, ModelEnum
|
5
8
|
|
@@ -89,3 +92,196 @@ create_project_collaborators = CreateProjectCollaborators(
|
|
89
92
|
def _validate_collaborators(self, collaborators: List[Dict[str, Any]]):
|
90
93
|
if not isinstance(collaborators, list):
|
91
94
|
raise TypeError("Collaborators must be a list.")
|
95
|
+
|
96
|
+
|
97
|
+
@dataclass(frozen=True)
|
98
|
+
class ProjectMinimal(ModelBase):
|
99
|
+
"""Minimal Project object."""
|
100
|
+
|
101
|
+
id: str = field(metadata={"docstring": "ID of the project."},)
|
102
|
+
|
103
|
+
def _validate_id(self, id: str): # noqa: A002
|
104
|
+
if not isinstance(id, str):
|
105
|
+
raise TypeError("'id' must be a string.")
|
106
|
+
|
107
|
+
name: str = field(metadata={"docstring": "Name of the project."},)
|
108
|
+
|
109
|
+
def _validate_name(self, name: str):
|
110
|
+
if not isinstance(name, str):
|
111
|
+
raise TypeError("'name' must be a string.")
|
112
|
+
|
113
|
+
description: str = field(metadata={"docstring": "Description of the project."},)
|
114
|
+
|
115
|
+
def _validate_description(self, description: str):
|
116
|
+
if not isinstance(description, str):
|
117
|
+
raise TypeError("'description' must be a string.")
|
118
|
+
|
119
|
+
created_at: str = field(
|
120
|
+
metadata={"docstring": "Datetime of the project creation."},
|
121
|
+
)
|
122
|
+
|
123
|
+
def _validate_created_at(self, created_at: str):
|
124
|
+
if not isinstance(created_at, str):
|
125
|
+
raise TypeError("'created_at' must be a string.")
|
126
|
+
|
127
|
+
creator_id: Optional[str] = field(
|
128
|
+
default=None, metadata={"docstring": "ID of the creator of the project."},
|
129
|
+
)
|
130
|
+
|
131
|
+
def _validate_creator_id(self, creator_id: Optional[str]):
|
132
|
+
if creator_id is not None and not isinstance(creator_id, str):
|
133
|
+
raise TypeError("'creator_id' must be a string.")
|
134
|
+
|
135
|
+
parent_cloud_id: Optional[str] = field(
|
136
|
+
default=None, metadata={"docstring": "ID of the parent cloud."},
|
137
|
+
)
|
138
|
+
|
139
|
+
def _validate_parent_cloud_id(self, parent_cloud_id: Optional[str]):
|
140
|
+
if parent_cloud_id is not None and not isinstance(parent_cloud_id, str):
|
141
|
+
raise TypeError("'parent_cloud_id' must be a string.")
|
142
|
+
|
143
|
+
@classmethod
|
144
|
+
def from_dict(cls, data: Dict[str, Any]) -> "ProjectMinimal":
|
145
|
+
# remove any fields that are not in the dataclass
|
146
|
+
valid_fields = {field_.name for field_ in fields(cls)}
|
147
|
+
filtered_data = {k: v for k, v in data.items() if k in valid_fields}
|
148
|
+
return cls(**filtered_data)
|
149
|
+
|
150
|
+
|
151
|
+
@dataclass(frozen=True)
|
152
|
+
class Project(ProjectMinimal):
|
153
|
+
"""Project object.
|
154
|
+
"""
|
155
|
+
|
156
|
+
__doc_py_example__ = """\
|
157
|
+
import anyscale
|
158
|
+
from anyscale.project.models import Project
|
159
|
+
|
160
|
+
project: Project = anyscale.project.get(project_id="my-project-id")
|
161
|
+
"""
|
162
|
+
|
163
|
+
is_owner: bool = field(
|
164
|
+
default=False,
|
165
|
+
metadata={"docstring": "Whether the user is the owner of the project."},
|
166
|
+
)
|
167
|
+
|
168
|
+
def _validate_is_owner(self, is_owner: bool):
|
169
|
+
if not isinstance(is_owner, bool):
|
170
|
+
raise TypeError("'is_owner' must be a boolean.")
|
171
|
+
|
172
|
+
is_read_only: bool = field(
|
173
|
+
default=False,
|
174
|
+
metadata={"docstring": "Whether the user has read-only access to the project."},
|
175
|
+
)
|
176
|
+
|
177
|
+
def _validate_is_read_only(self, is_read_only: bool):
|
178
|
+
if not isinstance(is_read_only, bool):
|
179
|
+
raise TypeError("'is_read_only' must be a boolean.")
|
180
|
+
|
181
|
+
directory_name: str = field(
|
182
|
+
default="",
|
183
|
+
metadata={
|
184
|
+
"docstring": "Directory name of project to be used as working directory of clusters."
|
185
|
+
},
|
186
|
+
)
|
187
|
+
|
188
|
+
def _validate_directory_name(self, directory_name: str):
|
189
|
+
if not isinstance(directory_name, str):
|
190
|
+
raise TypeError("'directory_name' must be a string.")
|
191
|
+
|
192
|
+
is_default: bool = field(
|
193
|
+
default=False,
|
194
|
+
metadata={
|
195
|
+
"docstring": "Whether the project is the default project for the organization."
|
196
|
+
},
|
197
|
+
)
|
198
|
+
|
199
|
+
def _validate_is_default(self, is_default: bool):
|
200
|
+
if not isinstance(is_default, bool):
|
201
|
+
raise TypeError("'is_default' must be a boolean.")
|
202
|
+
|
203
|
+
initial_cluster_config: Optional[Union[str, Dict[str, Any]]] = field(
|
204
|
+
default=None,
|
205
|
+
metadata={"docstring": "Initial cluster config associated with the project."},
|
206
|
+
)
|
207
|
+
|
208
|
+
def _validate_initial_cluster_config(
|
209
|
+
self, initial_cluster_config: Union[str, Dict[str, Any], None]
|
210
|
+
):
|
211
|
+
if initial_cluster_config is not None and not isinstance(
|
212
|
+
initial_cluster_config, (str, dict)
|
213
|
+
):
|
214
|
+
raise TypeError("'initial_cluster_config' must be a string or dictionary.")
|
215
|
+
|
216
|
+
last_used_cloud_id: Optional[str] = field(
|
217
|
+
default=None,
|
218
|
+
metadata={
|
219
|
+
"docstring": "ID of the last cloud used in this project, or by the user if this is a new project."
|
220
|
+
},
|
221
|
+
)
|
222
|
+
|
223
|
+
def _validate_last_used_cloud_id(self, last_used_cloud_id: Optional[str]):
|
224
|
+
if last_used_cloud_id is not None and not isinstance(last_used_cloud_id, str):
|
225
|
+
raise TypeError("'last_used_cloud_id' must be a string.")
|
226
|
+
|
227
|
+
owners: List[str] = field(
|
228
|
+
default_factory=list,
|
229
|
+
metadata={
|
230
|
+
"docstring": "List of IDs of users who have owner access to the project."
|
231
|
+
},
|
232
|
+
)
|
233
|
+
|
234
|
+
def _validate_owners(self, owners: List[str]):
|
235
|
+
if not isinstance(owners, list):
|
236
|
+
raise TypeError("'owners' must be a list.")
|
237
|
+
for owner in owners:
|
238
|
+
if not isinstance(owner, str):
|
239
|
+
raise TypeError(f"'{owner}' must be a string.")
|
240
|
+
|
241
|
+
@classmethod
|
242
|
+
def from_dict(cls, d: Dict[str, Any]) -> "Project":
|
243
|
+
data = d.copy()
|
244
|
+
# convert datetime fields to string
|
245
|
+
for field_ in fields(cls):
|
246
|
+
if field_.name in data and isinstance(data[field_.name], datetime):
|
247
|
+
data[field_.name] = data[field_.name].strftime("%Y-%m-%d %H:%M:%S")
|
248
|
+
|
249
|
+
# convert initial_cluster_config JSON string to dict
|
250
|
+
if "initial_cluster_config" in data and isinstance(
|
251
|
+
data["initial_cluster_config"], str
|
252
|
+
):
|
253
|
+
with contextlib.suppress(json.JSONDecodeError):
|
254
|
+
data["initial_cluster_config"] = json.loads(
|
255
|
+
data["initial_cluster_config"]
|
256
|
+
)
|
257
|
+
|
258
|
+
# convert owners list of dicts to list of string IDs
|
259
|
+
if "owners" in data and isinstance(data["owners"], list):
|
260
|
+
data["owners"] = [owner.get("id") for owner in data["owners"]]
|
261
|
+
|
262
|
+
# remove any fields that are not in the dataclass
|
263
|
+
valid_fields = {field_.name for field_ in fields(cls)}
|
264
|
+
filtered_data = {k: v for k, v in data.items() if k in valid_fields}
|
265
|
+
return cls(**filtered_data)
|
266
|
+
|
267
|
+
|
268
|
+
class ProjectSortField(ModelEnum):
|
269
|
+
"""Field to sort projects by."""
|
270
|
+
|
271
|
+
NAME = "NAME"
|
272
|
+
|
273
|
+
__docstrings__ = {
|
274
|
+
NAME: "Sort by project name.",
|
275
|
+
}
|
276
|
+
|
277
|
+
|
278
|
+
class ProjectSortOrder(ModelEnum):
|
279
|
+
"""Direction of sorting."""
|
280
|
+
|
281
|
+
ASC = "ASC"
|
282
|
+
DESC = "DESC"
|
283
|
+
|
284
|
+
__docstrings__ = {
|
285
|
+
ASC: "Sort in ascending order.",
|
286
|
+
DESC: "Sort in descending order.",
|
287
|
+
}
|