anyscale 0.26.28__py3-none-any.whl → 0.26.30__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.
Files changed (54) hide show
  1. anyscale/__init__.py +10 -0
  2. anyscale/_private/anyscale_client/anyscale_client.py +69 -0
  3. anyscale/_private/anyscale_client/common.py +38 -0
  4. anyscale/_private/anyscale_client/fake_anyscale_client.py +11 -0
  5. anyscale/_private/docgen/__main__.py +4 -18
  6. anyscale/_private/docgen/api.md +0 -125
  7. anyscale/_private/docgen/models.md +0 -111
  8. anyscale/client/README.md +0 -6
  9. anyscale/client/openapi_client/__init__.py +0 -4
  10. anyscale/client/openapi_client/api/default_api.py +0 -228
  11. anyscale/client/openapi_client/models/__init__.py +0 -4
  12. anyscale/client/openapi_client/models/workload_info.py +59 -3
  13. anyscale/commands/command_examples.py +10 -0
  14. anyscale/commands/job_queue_commands.py +295 -104
  15. anyscale/commands/list_util.py +14 -1
  16. anyscale/commands/machine_pool_commands.py +25 -11
  17. anyscale/commands/service_commands.py +10 -14
  18. anyscale/commands/workspace_commands_v2.py +462 -25
  19. anyscale/controllers/job_controller.py +5 -210
  20. anyscale/job_queue/__init__.py +89 -0
  21. anyscale/job_queue/_private/job_queue_sdk.py +158 -0
  22. anyscale/job_queue/commands.py +130 -0
  23. anyscale/job_queue/models.py +284 -0
  24. anyscale/scripts.py +1 -1
  25. anyscale/sdk/anyscale_client/__init__.py +0 -11
  26. anyscale/sdk/anyscale_client/api/default_api.py +140 -1433
  27. anyscale/sdk/anyscale_client/models/__init__.py +0 -11
  28. anyscale/service/__init__.py +4 -1
  29. anyscale/service/_private/service_sdk.py +5 -0
  30. anyscale/service/commands.py +4 -2
  31. anyscale/utils/ssh_websocket_proxy.py +178 -0
  32. anyscale/version.py +1 -1
  33. {anyscale-0.26.28.dist-info → anyscale-0.26.30.dist-info}/METADATA +3 -1
  34. {anyscale-0.26.28.dist-info → anyscale-0.26.30.dist-info}/RECORD +39 -49
  35. anyscale/client/openapi_client/models/serve_deployment_fast_api_docs_status.py +0 -123
  36. anyscale/client/openapi_client/models/servedeploymentfastapidocsstatus_response.py +0 -121
  37. anyscale/client/openapi_client/models/web_terminal.py +0 -121
  38. anyscale/client/openapi_client/models/webterminal_response.py +0 -121
  39. anyscale/sdk/anyscale_client/models/cluster_environment_build_log_response.py +0 -123
  40. anyscale/sdk/anyscale_client/models/clusterenvironmentbuildlogresponse_response.py +0 -121
  41. anyscale/sdk/anyscale_client/models/create_cloud.py +0 -518
  42. anyscale/sdk/anyscale_client/models/object_storage_config.py +0 -122
  43. anyscale/sdk/anyscale_client/models/object_storage_config_s3.py +0 -256
  44. anyscale/sdk/anyscale_client/models/objectstorageconfig_response.py +0 -121
  45. anyscale/sdk/anyscale_client/models/session_operation.py +0 -266
  46. anyscale/sdk/anyscale_client/models/session_operation_type.py +0 -101
  47. anyscale/sdk/anyscale_client/models/sessionoperation_response.py +0 -121
  48. anyscale/sdk/anyscale_client/models/update_cloud.py +0 -150
  49. anyscale/sdk/anyscale_client/models/update_project.py +0 -150
  50. {anyscale-0.26.28.dist-info → anyscale-0.26.30.dist-info}/LICENSE +0 -0
  51. {anyscale-0.26.28.dist-info → anyscale-0.26.30.dist-info}/NOTICE +0 -0
  52. {anyscale-0.26.28.dist-info → anyscale-0.26.30.dist-info}/WHEEL +0 -0
  53. {anyscale-0.26.28.dist-info → anyscale-0.26.30.dist-info}/entry_points.txt +0 -0
  54. {anyscale-0.26.28.dist-info → anyscale-0.26.30.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,284 @@
1
+ from dataclasses import dataclass, field
2
+ from datetime import datetime
3
+ from typing import get_type_hints, Literal, Optional, TYPE_CHECKING, Union
4
+
5
+ from anyscale._private.models import ModelBase, ModelEnum
6
+
7
+
8
+ class JobQueueState(ModelEnum):
9
+ """Current state of a job queue."""
10
+
11
+ ACTIVE = "ACTIVE"
12
+ SEALED = "SEALED"
13
+ # Add other potential states if necessary based on API reality
14
+ UNKNOWN = "UNKNOWN"
15
+
16
+ __docstrings__ = {
17
+ ACTIVE: "The job queue is active and accepting jobs.",
18
+ SEALED: "The job queue is sealed and not accepting new jobs. It may still be processing existing jobs.",
19
+ UNKNOWN: "The state of the job queue is unknown or could not be determined.",
20
+ }
21
+
22
+
23
+ class JobQueueSortField(ModelEnum):
24
+ """Fields available for sorting job queues."""
25
+
26
+ ID = "ID"
27
+ NAME = "NAME"
28
+ CREATED_AT = "CREATED_AT"
29
+ CREATOR_ID = "CREATOR_ID"
30
+ CREATOR_EMAIL = "CREATOR_EMAIL"
31
+ PROJECT_ID = "PROJECT_ID"
32
+ CLOUD_ID = "CLOUD_ID"
33
+ QUEUE_STATE = "QUEUE_STATE"
34
+ CLUSTER_STATE = "CLUSTER_STATE"
35
+
36
+ __docstrings__ = {
37
+ ID: "Sort by Job Queue ID.",
38
+ NAME: "Sort by Job Queue name.",
39
+ CREATED_AT: "Sort by creation timestamp.",
40
+ CREATOR_ID: "Sort by the ID of the creator.",
41
+ CREATOR_EMAIL: "Sort by the email of the creator.",
42
+ PROJECT_ID: "Sort by the Project ID.",
43
+ CLOUD_ID: "Sort by the Cloud ID.",
44
+ QUEUE_STATE: "Sort by the Job Queue's state (ACTIVE, SEALED).",
45
+ CLUSTER_STATE: "Sort by the state of the associated cluster.",
46
+ }
47
+
48
+
49
+ class ExecutionMode(ModelEnum):
50
+ """Execution mode of a job queue."""
51
+
52
+ FIFO = "FIFO"
53
+ LIFO = "LIFO"
54
+ PRIORITY = "PRIORITY"
55
+ # Add other execution modes as needed
56
+ UNKNOWN = "UNKNOWN"
57
+
58
+ __docstrings__ = {
59
+ FIFO: "FIFO execution mode.",
60
+ LIFO: "LIFO execution mode.",
61
+ PRIORITY: "Priority-based execution mode.",
62
+ UNKNOWN: "Unknown execution mode.",
63
+ }
64
+
65
+
66
+ class ClusterState(ModelEnum):
67
+ """Possible states for a cluster."""
68
+
69
+ RUNNING = "RUNNING"
70
+ TERMINATED = "TERMINATED"
71
+ PENDING = "PENDING"
72
+ # Add other states as needed
73
+ UNKNOWN = "UNKNOWN"
74
+
75
+ __docstrings__ = {
76
+ RUNNING: "The cluster is running.",
77
+ TERMINATED: "The cluster is terminated.",
78
+ PENDING: "The cluster is pending creation.",
79
+ UNKNOWN: "The state of the cluster is unknown.",
80
+ }
81
+
82
+
83
+ @dataclass(frozen=True)
84
+ class JobQueueStatus(ModelBase):
85
+ """Represents the status and details of a Job Queue."""
86
+
87
+ id: str = field(metadata={"docstring": "Unique ID of the job queue."})
88
+ state: Union[JobQueueState, str] = field(
89
+ metadata={"docstring": "Current state of the job queue."}
90
+ )
91
+ name: Optional[str] = field(
92
+ default=None, metadata={"docstring": "Name of the job queue."}
93
+ )
94
+ creator_email: Optional[str] = field(
95
+ default=None,
96
+ metadata={"docstring": "Email of the user who created the job queue."},
97
+ )
98
+ project_id: Optional[str] = field(
99
+ default=None,
100
+ metadata={"docstring": "ID of the project this job queue belongs to."},
101
+ )
102
+ created_at: Optional[datetime] = field(
103
+ default=None,
104
+ metadata={"docstring": "Timestamp when the job queue was created."},
105
+ )
106
+ max_concurrency: Optional[int] = field(
107
+ default=None,
108
+ metadata={"docstring": "Maximum number of jobs allowed to run concurrently."},
109
+ )
110
+ idle_timeout_s: Optional[int] = field(
111
+ default=None,
112
+ metadata={
113
+ "docstring": "Idle timeout in seconds before the queue's cluster may shut down."
114
+ },
115
+ )
116
+ user_provided_id: Optional[str] = field(
117
+ default=None,
118
+ metadata={"docstring": "User provided identifier of the job queue."},
119
+ )
120
+ execution_mode: Optional[Union[ExecutionMode, str]] = field(
121
+ default=None, metadata={"docstring": "The execution mode of the job queue."}
122
+ )
123
+ creator_id: Optional[str] = field(
124
+ default=None,
125
+ metadata={"docstring": "Identifier of user who created the job queue."},
126
+ )
127
+ cloud_id: Optional[str] = field(
128
+ default=None,
129
+ metadata={"docstring": "The cloud ID associated with the job queue."},
130
+ )
131
+ total_jobs: Optional[int] = field(
132
+ default=None, metadata={"docstring": "Total number of jobs in the job queue."},
133
+ )
134
+ successful_jobs: Optional[int] = field(
135
+ default=None,
136
+ metadata={"docstring": "Number of successful jobs in the job queue."},
137
+ )
138
+ failed_jobs: Optional[int] = field(
139
+ default=None, metadata={"docstring": "Number of failed jobs in the job queue."},
140
+ )
141
+ active_jobs: Optional[int] = field(
142
+ default=None, metadata={"docstring": "Number of active jobs in the job queue."},
143
+ )
144
+
145
+ def _validate_id(self, id: str) -> str: # noqa: A002
146
+ if not isinstance(id, str) or not id:
147
+ raise ValueError("'id' must be a non-empty string.")
148
+ return id
149
+
150
+ def _validate_name(self, name: Optional[str]) -> Optional[str]:
151
+ if name is not None and not isinstance(name, str):
152
+ raise ValueError("'name' must be a string or None.")
153
+ return name
154
+
155
+ def _validate_state(self, state: Union[JobQueueState, str]) -> JobQueueState:
156
+ return JobQueueState.validate(state)
157
+
158
+ def _validate_creator_email(self, creator_email: Optional[str]) -> Optional[str]:
159
+ if creator_email is not None and not isinstance(creator_email, str):
160
+ raise ValueError("'creator_email' must be a string or None.")
161
+ return creator_email
162
+
163
+ def _validate_project_id(self, project_id: Optional[str]) -> Optional[str]:
164
+ if project_id is not None and not isinstance(project_id, str):
165
+ raise ValueError("'project_id' must be a string or None.")
166
+ return project_id
167
+
168
+ def _validate_created_at(
169
+ self, created_at: Optional[datetime]
170
+ ) -> Optional[datetime]:
171
+ if created_at is not None and not isinstance(created_at, datetime):
172
+ raise ValueError("'created_at' must be a datetime object or None.")
173
+ return created_at
174
+
175
+ def _validate_max_concurrency(
176
+ self, max_concurrency: Optional[int]
177
+ ) -> Optional[int]:
178
+ if max_concurrency is not None:
179
+ if not isinstance(max_concurrency, int):
180
+ raise ValueError("'max_concurrency' must be an integer or None.")
181
+ if max_concurrency < 0:
182
+ raise ValueError("'max_concurrency' cannot be negative.")
183
+ return max_concurrency
184
+
185
+ def _validate_idle_timeout_s(self, idle_timeout_s: Optional[int]) -> Optional[int]:
186
+ if idle_timeout_s is not None:
187
+ if not isinstance(idle_timeout_s, int):
188
+ raise ValueError("'idle_timeout_s' must be an integer or None.")
189
+ if idle_timeout_s < 0:
190
+ raise ValueError("'idle_timeout_s' cannot be negative.")
191
+ return idle_timeout_s
192
+
193
+ def _validate_user_provided_id(
194
+ self, user_provided_id: Optional[str]
195
+ ) -> Optional[str]:
196
+ if user_provided_id is not None and not isinstance(user_provided_id, str):
197
+ raise ValueError("'user_provided_id' must be a string or None.")
198
+ return user_provided_id
199
+
200
+ def _validate_execution_mode(
201
+ self, execution_mode: Optional[Union[ExecutionMode, str]]
202
+ ) -> Optional[ExecutionMode]:
203
+ if execution_mode is not None:
204
+ return ExecutionMode.validate(execution_mode)
205
+ return None
206
+
207
+ def _validate_creator_id(self, creator_id: Optional[str]) -> Optional[str]:
208
+ if creator_id is not None and not isinstance(creator_id, str):
209
+ raise ValueError("'creator_id' must be a string or None.")
210
+ return creator_id
211
+
212
+ def _validate_cluster_id(self, cluster_id: Optional[str]) -> Optional[str]:
213
+ if cluster_id is not None and not isinstance(cluster_id, str):
214
+ raise ValueError("'cluster_id' must be a string or None.")
215
+ return cluster_id
216
+
217
+ def _validate_current_cluster_state(
218
+ self, current_cluster_state: Optional[Union[ClusterState, str]]
219
+ ) -> Optional[ClusterState]:
220
+ if current_cluster_state is not None:
221
+ return ClusterState.validate(current_cluster_state)
222
+ return None
223
+
224
+ def _validate_cloud_id(self, cloud_id: Optional[str]) -> Optional[str]:
225
+ if cloud_id is not None and not isinstance(cloud_id, str):
226
+ raise ValueError("'cloud_id' must be a string or None.")
227
+ return cloud_id
228
+
229
+ def _validate_total_jobs(self, total_jobs: Optional[int]) -> Optional[int]:
230
+ if total_jobs is not None:
231
+ if not isinstance(total_jobs, int):
232
+ raise ValueError("'total_jobs' must be an integer or None.")
233
+ if total_jobs < 0:
234
+ raise ValueError("'total_jobs' cannot be negative.")
235
+ return total_jobs
236
+
237
+ def _validate_successful_jobs(
238
+ self, successful_jobs: Optional[int]
239
+ ) -> Optional[int]:
240
+ if successful_jobs is not None:
241
+ if not isinstance(successful_jobs, int):
242
+ raise ValueError("'successful_jobs' must be an integer or None.")
243
+ if successful_jobs < 0:
244
+ raise ValueError("'successful_jobs' cannot be negative.")
245
+ return successful_jobs
246
+
247
+ def _validate_failed_jobs(self, failed_jobs: Optional[int]) -> Optional[int]:
248
+ if failed_jobs is not None:
249
+ if not isinstance(failed_jobs, int):
250
+ raise ValueError("'failed_jobs' must be an integer or None.")
251
+ if failed_jobs < 0:
252
+ raise ValueError("'failed_jobs' cannot be negative.")
253
+ return failed_jobs
254
+
255
+ def _validate_active_jobs(self, active_jobs: Optional[int]) -> Optional[int]:
256
+ if active_jobs is not None:
257
+ if not isinstance(active_jobs, int):
258
+ raise ValueError("'active_jobs' must be an integer or None.")
259
+ if active_jobs < 0:
260
+ raise ValueError("'active_jobs' cannot be negative.")
261
+ return active_jobs
262
+
263
+
264
+ if TYPE_CHECKING:
265
+ JobQueueStatusKeys = Literal[
266
+ "active_jobs",
267
+ "cloud_id",
268
+ "created_at",
269
+ "creator_email",
270
+ "creator_id",
271
+ "execution_mode",
272
+ "failed_jobs",
273
+ "id",
274
+ "idle_timeout_s",
275
+ "max_concurrency",
276
+ "name",
277
+ "project_id",
278
+ "state",
279
+ "successful_jobs",
280
+ "total_jobs",
281
+ "user_provided_id",
282
+ ]
283
+ else:
284
+ JobQueueStatusKeys = Literal[tuple(get_type_hints(JobQueueStatus).keys())]
anyscale/scripts.py CHANGED
@@ -121,7 +121,7 @@ cli.add_command(version_cli)
121
121
  cli.add_command(list_cli)
122
122
  cli.add_command(cluster_env_cli)
123
123
  cli.add_command(job_cli)
124
- # cli.add_command(job_queue_cli) # TODO will be enabled later
124
+ cli.add_command(job_queue_cli)
125
125
  cli.add_command(schedule_cli)
126
126
  cli.add_command(service_cli)
127
127
  cli.add_command(cluster_cli)
@@ -58,7 +58,6 @@ from anyscale_client.models.cluster_compute_config import ClusterComputeConfig
58
58
  from anyscale_client.models.cluster_computes_query import ClusterComputesQuery
59
59
  from anyscale_client.models.cluster_environment import ClusterEnvironment
60
60
  from anyscale_client.models.cluster_environment_build import ClusterEnvironmentBuild
61
- from anyscale_client.models.cluster_environment_build_log_response import ClusterEnvironmentBuildLogResponse
62
61
  from anyscale_client.models.cluster_environment_build_operation import ClusterEnvironmentBuildOperation
63
62
  from anyscale_client.models.cluster_environment_build_status import ClusterEnvironmentBuildStatus
64
63
  from anyscale_client.models.cluster_environments_query import ClusterEnvironmentsQuery
@@ -78,7 +77,6 @@ from anyscale_client.models.clusterenvironment_list_response import Clusterenvir
78
77
  from anyscale_client.models.clusterenvironment_response import ClusterenvironmentResponse
79
78
  from anyscale_client.models.clusterenvironmentbuild_list_response import ClusterenvironmentbuildListResponse
80
79
  from anyscale_client.models.clusterenvironmentbuild_response import ClusterenvironmentbuildResponse
81
- from anyscale_client.models.clusterenvironmentbuildlogresponse_response import ClusterenvironmentbuildlogresponseResponse
82
80
  from anyscale_client.models.clusterenvironmentbuildoperation_response import ClusterenvironmentbuildoperationResponse
83
81
  from anyscale_client.models.clusteroperation_response import ClusteroperationResponse
84
82
  from anyscale_client.models.clusters_query import ClustersQuery
@@ -93,7 +91,6 @@ from anyscale_client.models.create_byod_app_config_configuration_schema import C
93
91
  from anyscale_client.models.create_byod_cluster_environment import CreateBYODClusterEnvironment
94
92
  from anyscale_client.models.create_byod_cluster_environment_build import CreateBYODClusterEnvironmentBuild
95
93
  from anyscale_client.models.create_byod_cluster_environment_configuration_schema import CreateBYODClusterEnvironmentConfigurationSchema
96
- from anyscale_client.models.create_cloud import CreateCloud
97
94
  from anyscale_client.models.create_cluster import CreateCluster
98
95
  from anyscale_client.models.create_cluster_compute import CreateClusterCompute
99
96
  from anyscale_client.models.create_cluster_compute_config import CreateClusterComputeConfig
@@ -130,9 +127,6 @@ from anyscale_client.models.log_stream import LogStream
130
127
  from anyscale_client.models.logdownloadresult_response import LogdownloadresultResponse
131
128
  from anyscale_client.models.logstream_response import LogstreamResponse
132
129
  from anyscale_client.models.node_type import NodeType
133
- from anyscale_client.models.object_storage_config import ObjectStorageConfig
134
- from anyscale_client.models.object_storage_config_s3 import ObjectStorageConfigS3
135
- from anyscale_client.models.objectstorageconfig_response import ObjectstorageconfigResponse
136
130
  from anyscale_client.models.operation_error import OperationError
137
131
  from anyscale_client.models.operation_progress import OperationProgress
138
132
  from anyscale_client.models.operation_result import OperationResult
@@ -178,14 +172,11 @@ from anyscale_client.models.service_version_state import ServiceVersionState
178
172
  from anyscale_client.models.servicemodel_list_response import ServicemodelListResponse
179
173
  from anyscale_client.models.servicemodel_response import ServicemodelResponse
180
174
  from anyscale_client.models.session import Session
181
- from anyscale_client.models.session_operation import SessionOperation
182
- from anyscale_client.models.session_operation_type import SessionOperationType
183
175
  from anyscale_client.models.session_response import SessionResponse
184
176
  from anyscale_client.models.session_starting_up_data import SessionStartingUpData
185
177
  from anyscale_client.models.session_state import SessionState
186
178
  from anyscale_client.models.session_state_data import SessionStateData
187
179
  from anyscale_client.models.session_stopping_data import SessionStoppingData
188
- from anyscale_client.models.sessionoperation_response import SessionoperationResponse
189
180
  from anyscale_client.models.sort_by_clause_jobs_sort_field import SortByClauseJobsSortField
190
181
  from anyscale_client.models.sort_order import SortOrder
191
182
  from anyscale_client.models.ssoconfig_response import SsoconfigResponse
@@ -196,10 +187,8 @@ from anyscale_client.models.terminate_cluster_options import TerminateClusterOpt
196
187
  from anyscale_client.models.text_query import TextQuery
197
188
  from anyscale_client.models.tracing_config import TracingConfig
198
189
  from anyscale_client.models.ux_instance import UXInstance
199
- from anyscale_client.models.update_cloud import UpdateCloud
200
190
  from anyscale_client.models.update_cluster import UpdateCluster
201
191
  from anyscale_client.models.update_organization import UpdateOrganization
202
- from anyscale_client.models.update_project import UpdateProject
203
192
  from anyscale_client.models.user_service_access_types import UserServiceAccessTypes
204
193
  from anyscale_client.models.validation_error import ValidationError
205
194
  from anyscale_client.models.worker_node_type import WorkerNodeType