anyscale 0.26.14__py3-none-any.whl → 0.26.16__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 +4 -2
- anyscale/_private/anyscale_client/common.py +6 -4
- anyscale/_private/anyscale_client/fake_anyscale_client.py +16 -7
- anyscale/_private/docgen/__main__.py +4 -4
- anyscale/_private/docgen/generator.py +2 -2
- anyscale/_private/models/model_base.py +5 -2
- anyscale/_private/sdk/__init__.py +2 -2
- anyscale/_private/utils/progress_util.py +2 -2
- anyscale/_private/workload/workload_sdk.py +10 -7
- anyscale/aggregated_instance_usage/commands.py +6 -2
- anyscale/anyscale-cloud-setup.yaml +4 -0
- anyscale/client/README.md +8 -11
- anyscale/client/openapi_client/__init__.py +6 -8
- anyscale/client/openapi_client/api/default_api.py +292 -377
- anyscale/client/openapi_client/models/__init__.py +6 -8
- anyscale/client/openapi_client/models/alert_type.py +11 -2
- anyscale/client/openapi_client/models/create_job_queue_requests.py +3 -32
- anyscale/client/openapi_client/models/{product_autoscaler_flag.py → list_ray_sessions_response.py} +22 -23
- anyscale/client/openapi_client/models/{productautoscalerflag_response.py → listraysessionsresponse_response.py} +11 -11
- anyscale/client/openapi_client/models/metric.py +133 -3
- anyscale/client/openapi_client/models/ray_session.py +121 -0
- anyscale/client/openapi_client/models/task_exception_group_aggregate.py +28 -1
- anyscale/client/openapi_client/models/{taskexceptiongroupaggregate_list_response.py → task_exception_group_aggregate_response.py} +52 -25
- anyscale/client/openapi_client/models/task_function_name_group_aggregate.py +28 -1
- anyscale/client/openapi_client/models/{taskfunctionnamegroupaggregate_list_response.py → task_function_name_group_aggregate_response.py} +52 -25
- anyscale/client/openapi_client/models/task_job_group_aggregate.py +28 -1
- anyscale/client/openapi_client/models/{taskjobgroupaggregate_list_response.py → task_job_group_aggregate_response.py} +52 -25
- anyscale/client/openapi_client/models/task_table_row.py +19 -19
- anyscale/cloud/__init__.py +2 -2
- anyscale/cloud/_private/cloud_sdk.py +2 -2
- anyscale/cloud/commands.py +9 -6
- anyscale/cloud_resource.py +1 -1
- anyscale/cloud_utils.py +11 -6
- anyscale/cluster_compute.py +6 -5
- anyscale/cluster_env.py +10 -5
- anyscale/commands/login_commands.py +24 -3
- anyscale/commands/schedule_commands.py +2 -1
- anyscale/compute_config/_private/compute_config_sdk.py +1 -1
- anyscale/compute_config/commands.py +15 -7
- anyscale/connect_utils/prepare_cluster.py +14 -4
- anyscale/controllers/cloud_controller.py +9 -9
- anyscale/controllers/cloud_functional_verification_controller.py +4 -2
- anyscale/controllers/cluster_controller.py +1 -0
- anyscale/controllers/job_controller.py +1 -1
- anyscale/controllers/service_controller.py +2 -1
- anyscale/image/commands.py +6 -6
- anyscale/job/commands.py +12 -12
- anyscale/organization_invitation/commands.py +11 -7
- anyscale/project/__init__.py +2 -2
- anyscale/project/_private/project_sdk.py +2 -2
- anyscale/project/commands.py +3 -3
- anyscale/project_utils.py +5 -4
- anyscale/resource_quota/commands.py +18 -10
- anyscale/schedule/commands.py +12 -8
- anyscale/sdk/anyscale_client/sdk.py +5 -4
- anyscale/service/commands.py +17 -17
- anyscale/service_account/commands.py +12 -10
- anyscale/user/commands.py +5 -3
- anyscale/utils/connect_helpers.py +16 -3
- anyscale/utils/gcp_utils.py +25 -9
- anyscale/utils/runtime_env.py +3 -1
- anyscale/version.py +1 -1
- anyscale/workspace/__init__.py +10 -5
- anyscale/workspace/_private/workspace_sdk.py +9 -7
- anyscale/workspace/commands.py +25 -23
- {anyscale-0.26.14.dist-info → anyscale-0.26.16.dist-info}/METADATA +1 -1
- {anyscale-0.26.14.dist-info → anyscale-0.26.16.dist-info}/RECORD +72 -74
- anyscale/client/openapi_client/models/aviary_model_config_v2.py +0 -358
- anyscale/client/openapi_client/models/buffer_registration.py +0 -285
- anyscale/client/openapi_client/models/finish_ft_job_request_v2.py +0 -183
- {anyscale-0.26.14.dist-info → anyscale-0.26.16.dist-info}/LICENSE +0 -0
- {anyscale-0.26.14.dist-info → anyscale-0.26.16.dist-info}/NOTICE +0 -0
- {anyscale-0.26.14.dist-info → anyscale-0.26.16.dist-info}/WHEEL +0 -0
- {anyscale-0.26.14.dist-info → anyscale-0.26.16.dist-info}/entry_points.txt +0 -0
- {anyscale-0.26.14.dist-info → anyscale-0.26.16.dist-info}/top_level.txt +0 -0
anyscale/image/commands.py
CHANGED
@@ -36,13 +36,13 @@ def build(
|
|
36
36
|
*,
|
37
37
|
name: str,
|
38
38
|
ray_version: Optional[str] = None,
|
39
|
-
|
39
|
+
_private_sdk: Optional[PrivateImageSDK] = None,
|
40
40
|
) -> str:
|
41
41
|
"""Build an image from a Containerfile.
|
42
42
|
|
43
43
|
Returns the URI of the image.
|
44
44
|
"""
|
45
|
-
return
|
45
|
+
return _private_sdk.build_image_from_containerfile_with_image_uri( # type: ignore
|
46
46
|
name, containerfile, ray_version=ray_version
|
47
47
|
)
|
48
48
|
|
@@ -68,12 +68,12 @@ _GET_ARG_DOCSTRINGS = {
|
|
68
68
|
doc_py_example=_GET_EXAMPLE,
|
69
69
|
arg_docstrings=_GET_ARG_DOCSTRINGS,
|
70
70
|
)
|
71
|
-
def get(*, name: str,
|
71
|
+
def get(*, name: str, _private_sdk: Optional[PrivateImageSDK] = None) -> ImageBuild:
|
72
72
|
"""The name can contain an optional version tag, i.e., 'name:version'.
|
73
73
|
|
74
74
|
If no version is provided, the latest one will be returned.
|
75
75
|
"""
|
76
|
-
return
|
76
|
+
return _private_sdk.get(name) # type: ignore
|
77
77
|
|
78
78
|
|
79
79
|
_REGISTER_EXAMPLE = """
|
@@ -102,14 +102,14 @@ def register(
|
|
102
102
|
name: str,
|
103
103
|
ray_version: Optional[str] = None,
|
104
104
|
registry_login_secret: Optional[str] = None,
|
105
|
-
|
105
|
+
_private_sdk: Optional[PrivateImageSDK] = None,
|
106
106
|
) -> str:
|
107
107
|
"""
|
108
108
|
Registers a BYOD image with a container image name.
|
109
109
|
|
110
110
|
Returns the URI of the image.
|
111
111
|
"""
|
112
|
-
return
|
112
|
+
return _private_sdk.register_byod_image_with_name( # type: ignore
|
113
113
|
image_uri,
|
114
114
|
registry_login_secret=registry_login_secret,
|
115
115
|
ray_version=ray_version,
|
anyscale/job/commands.py
CHANGED
@@ -54,12 +54,12 @@ _SUBMIT_ARG_DOCSTRINGS = {"config": "The config options defining the job."}
|
|
54
54
|
doc_py_example=_SUBMIT_EXAMPLE,
|
55
55
|
arg_docstrings=_SUBMIT_ARG_DOCSTRINGS,
|
56
56
|
)
|
57
|
-
def submit(config: JobConfig, *,
|
57
|
+
def submit(config: JobConfig, *, _private_sdk: Optional[PrivateJobSDK] = None) -> str:
|
58
58
|
"""Submit a job.
|
59
59
|
|
60
60
|
Returns the id of the submitted job.
|
61
61
|
"""
|
62
|
-
return
|
62
|
+
return _private_sdk.submit(config) # type: ignore
|
63
63
|
|
64
64
|
|
65
65
|
_STATUS_EXAMPLE = """
|
@@ -89,12 +89,12 @@ def status(
|
|
89
89
|
id: Optional[str] = None, # noqa: A002
|
90
90
|
cloud: Optional[str] = None,
|
91
91
|
project: Optional[str] = None,
|
92
|
-
|
92
|
+
_private_sdk: Optional[PrivateJobSDK] = None,
|
93
93
|
**_kwargs: Dict[str, Any],
|
94
94
|
) -> JobStatus:
|
95
95
|
"""Get the status of a job."""
|
96
96
|
id = _resolve_id_from_args(id, _kwargs) # noqa: A001
|
97
|
-
return
|
97
|
+
return _private_sdk.status(name=name, job_id=id, cloud=cloud, project=project) # type: ignore
|
98
98
|
|
99
99
|
|
100
100
|
_TERMINATE_EXAMPLE = """
|
@@ -123,7 +123,7 @@ def terminate(
|
|
123
123
|
id: Optional[str] = None, # noqa: A002
|
124
124
|
cloud: Optional[str] = None,
|
125
125
|
project: Optional[str] = None,
|
126
|
-
|
126
|
+
_private_sdk: Optional[PrivateJobSDK] = None,
|
127
127
|
**_kwargs: Dict[str, Any],
|
128
128
|
) -> str:
|
129
129
|
"""Terminate a job.
|
@@ -133,7 +133,7 @@ def terminate(
|
|
133
133
|
Returns the id of the terminated job.
|
134
134
|
"""
|
135
135
|
id = _resolve_id_from_args(id, _kwargs) # noqa: A001
|
136
|
-
return
|
136
|
+
return _private_sdk.terminate(name=name, job_id=id, cloud=cloud, project=project) # type: ignore
|
137
137
|
|
138
138
|
|
139
139
|
_ARCHIVE_EXAMPLE = """
|
@@ -162,7 +162,7 @@ def archive(
|
|
162
162
|
id: Optional[str] = None, # noqa: A002
|
163
163
|
cloud: Optional[str] = None,
|
164
164
|
project: Optional[str] = None,
|
165
|
-
|
165
|
+
_private_sdk: Optional[PrivateJobSDK] = None,
|
166
166
|
**_kwargs: Dict[str, Any],
|
167
167
|
) -> str:
|
168
168
|
"""Archive a job.
|
@@ -172,7 +172,7 @@ def archive(
|
|
172
172
|
Returns the id of the archived job.
|
173
173
|
"""
|
174
174
|
id = _resolve_id_from_args(id, _kwargs) # noqa: A001
|
175
|
-
return
|
175
|
+
return _private_sdk.archive(name=name, job_id=id, cloud=cloud, project=project) # type: ignore
|
176
176
|
|
177
177
|
|
178
178
|
_WAIT_EXAMPLE = """\
|
@@ -204,12 +204,12 @@ def wait(
|
|
204
204
|
project: Optional[str] = None,
|
205
205
|
state: Union[JobState, str] = JobState.SUCCEEDED,
|
206
206
|
timeout_s: float = 1800,
|
207
|
-
|
207
|
+
_private_sdk: Optional[PrivateJobSDK] = None,
|
208
208
|
**_kwargs: Dict[str, Any],
|
209
209
|
):
|
210
210
|
""""Wait for a job to enter a specific state."""
|
211
211
|
id = _resolve_id_from_args(id, _kwargs) # noqa: A001
|
212
|
-
|
212
|
+
_private_sdk.wait( # type: ignore
|
213
213
|
name=name,
|
214
214
|
job_id=id,
|
215
215
|
cloud=cloud,
|
@@ -251,12 +251,12 @@ def get_logs(
|
|
251
251
|
run: Optional[str] = None,
|
252
252
|
mode: Union[str, JobLogMode] = JobLogMode.TAIL,
|
253
253
|
max_lines: Optional[int] = None,
|
254
|
-
|
254
|
+
_private_sdk: Optional[PrivateJobSDK] = None,
|
255
255
|
**_kwargs: Dict[str, Any],
|
256
256
|
) -> str:
|
257
257
|
"""Query the jobs for a job run."""
|
258
258
|
id = _resolve_id_from_args(id, _kwargs) # noqa: A001
|
259
|
-
return
|
259
|
+
return _private_sdk.get_logs( # type: ignore
|
260
260
|
job_id=id,
|
261
261
|
name=name,
|
262
262
|
cloud=cloud,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Dict, List, Tuple
|
1
|
+
from typing import Dict, List, Optional, Tuple
|
2
2
|
|
3
3
|
from anyscale._private.sdk import sdk_command
|
4
4
|
from anyscale.organization_invitation._private.organization_invitation_sdk import (
|
@@ -45,13 +45,15 @@ _DELETE_ARG_DOCSTRINGS = {
|
|
45
45
|
arg_docstrings=_CREATE_ARG_DOCSTRINGS,
|
46
46
|
)
|
47
47
|
def create(
|
48
|
-
emails: List[str],
|
48
|
+
emails: List[str],
|
49
|
+
*,
|
50
|
+
_private_sdk: Optional[PrivateOrganizationInvitationSDK] = None
|
49
51
|
) -> Tuple[List[str], List[str]]:
|
50
52
|
"""Creates organization invitations for the provided emails.
|
51
53
|
|
52
54
|
Returns a tuple of successful emails and error messages.
|
53
55
|
"""
|
54
|
-
return
|
56
|
+
return _private_sdk.create(emails=emails) # type: ignore
|
55
57
|
|
56
58
|
|
57
59
|
@sdk_command(
|
@@ -61,13 +63,13 @@ def create(
|
|
61
63
|
arg_docstrings=_LIST_ARG_DOCSTRINGS,
|
62
64
|
)
|
63
65
|
def list( # noqa: A001
|
64
|
-
*,
|
66
|
+
*, _private_sdk: Optional[PrivateOrganizationInvitationSDK] = None
|
65
67
|
) -> List[OrganizationInvitation]:
|
66
68
|
"""Lists organization invitations.
|
67
69
|
|
68
70
|
Returns a list of organization invitations.
|
69
71
|
"""
|
70
|
-
return
|
72
|
+
return _private_sdk.list() # type: ignore
|
71
73
|
|
72
74
|
|
73
75
|
@sdk_command(
|
@@ -76,9 +78,11 @@ def list( # noqa: A001
|
|
76
78
|
doc_py_example=_DELETE_EXAMPLE,
|
77
79
|
arg_docstrings=_DELETE_ARG_DOCSTRINGS,
|
78
80
|
)
|
79
|
-
def delete(
|
81
|
+
def delete(
|
82
|
+
email: str, *, _private_sdk: Optional[PrivateOrganizationInvitationSDK] = None
|
83
|
+
) -> str:
|
80
84
|
"""Deletes an organization invitation.
|
81
85
|
|
82
86
|
Returns the email of the deleted organization invitation.
|
83
87
|
"""
|
84
|
-
return
|
88
|
+
return _private_sdk.delete(email) # type: ignore
|
anyscale/project/__init__.py
CHANGED
@@ -29,7 +29,7 @@ class ProjectSDK:
|
|
29
29
|
)
|
30
30
|
def add_collaborators( # noqa: F811
|
31
31
|
self, cloud: str, project: str, collaborators: List[CreateProjectCollaborator],
|
32
|
-
) ->
|
32
|
+
) -> None:
|
33
33
|
"""Batch add collaborators to a project.
|
34
34
|
"""
|
35
|
-
|
35
|
+
self._private_sdk.add_collaborators(cloud, project, collaborators)
|
@@ -11,11 +11,11 @@ from anyscale.project.models import CreateProjectCollaborator
|
|
11
11
|
class PrivateProjectSDK(BaseSDK):
|
12
12
|
def add_collaborators(
|
13
13
|
self, cloud: str, project: str, collaborators: List[CreateProjectCollaborator]
|
14
|
-
) ->
|
14
|
+
) -> None:
|
15
15
|
cloud_id = self.client.get_cloud_id(cloud_name=cloud, compute_config_id=None)
|
16
16
|
project_id = self.client.get_project_id(parent_cloud_id=cloud_id, name=project)
|
17
17
|
|
18
|
-
|
18
|
+
self.client.add_project_collaborators(
|
19
19
|
project_id=project_id,
|
20
20
|
collaborators=[
|
21
21
|
CreateUserProjectCollaborator(
|
anyscale/project/commands.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import List
|
1
|
+
from typing import List, Optional
|
2
2
|
|
3
3
|
from anyscale._private.sdk import sdk_command
|
4
4
|
from anyscale.project._private.project_sdk import PrivateProjectSDK
|
@@ -49,8 +49,8 @@ def add_collaborators(
|
|
49
49
|
project: str,
|
50
50
|
collaborators: List[CreateProjectCollaborator],
|
51
51
|
*,
|
52
|
-
|
52
|
+
_private_sdk: Optional[PrivateProjectSDK] = None
|
53
53
|
) -> str:
|
54
54
|
"""Batch add collaborators to a project.
|
55
55
|
"""
|
56
|
-
return
|
56
|
+
return _private_sdk.add_collaborators(cloud, project, collaborators) # type: ignore
|
anyscale/project_utils.py
CHANGED
@@ -14,6 +14,7 @@ from anyscale.cluster_compute import (
|
|
14
14
|
get_cluster_compute_from_name,
|
15
15
|
get_selected_cloud_id_or_default,
|
16
16
|
)
|
17
|
+
from anyscale.sdk.anyscale_client.api.default_api import DefaultApi as SDKDefaultApi
|
17
18
|
from anyscale.sdk.anyscale_client.models.cluster_compute_config import (
|
18
19
|
ClusterComputeConfig,
|
19
20
|
)
|
@@ -395,7 +396,7 @@ def get_and_validate_project_id(
|
|
395
396
|
project_name: Optional[str],
|
396
397
|
parent_cloud_id: Optional[str],
|
397
398
|
api_client: DefaultApi,
|
398
|
-
anyscale_api_client: DefaultApi,
|
399
|
+
anyscale_api_client: Union[DefaultApi, SDKDefaultApi],
|
399
400
|
) -> str:
|
400
401
|
project_name = project_name or os.environ.get(PROJECT_NAME_ENV_VAR)
|
401
402
|
if project_id:
|
@@ -421,7 +422,7 @@ def get_and_validate_project_id(
|
|
421
422
|
|
422
423
|
def get_default_project(
|
423
424
|
api_client: Optional[DefaultApi] = None,
|
424
|
-
anyscale_api_client: Optional[DefaultApi] = None,
|
425
|
+
anyscale_api_client: Optional[Union[DefaultApi, SDKDefaultApi]] = None,
|
425
426
|
parent_cloud_id: Optional[str] = None,
|
426
427
|
):
|
427
428
|
"""
|
@@ -441,14 +442,14 @@ def get_default_project(
|
|
441
442
|
"Please specify a cloud for this command either through the cloud or "
|
442
443
|
"compute config arguments."
|
443
444
|
)
|
444
|
-
default_project = anyscale_api_client.get_default_project(
|
445
|
+
default_project = anyscale_api_client.get_default_project( # type: ignore
|
445
446
|
parent_cloud_id=parent_cloud_id
|
446
447
|
).result
|
447
448
|
return default_project
|
448
449
|
|
449
450
|
|
450
451
|
def infer_project_id( # noqa PLR0913
|
451
|
-
anyscale_api_client: DefaultApi,
|
452
|
+
anyscale_api_client: Union[DefaultApi, SDKDefaultApi],
|
452
453
|
api_client: DefaultApi,
|
453
454
|
log: BlockLogger,
|
454
455
|
project_id: Optional[str],
|
@@ -87,11 +87,13 @@ _DISABLE_DOCSTRINGS = {
|
|
87
87
|
arg_docstrings=_CREATE_DOCSTRINGS,
|
88
88
|
)
|
89
89
|
def create(
|
90
|
-
create_resource_quota: CreateResourceQuota,
|
90
|
+
create_resource_quota: CreateResourceQuota,
|
91
|
+
*,
|
92
|
+
_private_sdk: Optional[PrivateResourceQuotaSDK] = None
|
91
93
|
) -> ResourceQuota:
|
92
94
|
"""Create a resource quota.
|
93
95
|
"""
|
94
|
-
return
|
96
|
+
return _private_sdk.create(create_resource_quota) # type: ignore
|
95
97
|
|
96
98
|
|
97
99
|
@sdk_command(
|
@@ -107,10 +109,10 @@ def list( # noqa: A001
|
|
107
109
|
is_enabled: Optional[bool] = None,
|
108
110
|
max_items: int = 20,
|
109
111
|
*,
|
110
|
-
|
112
|
+
_private_sdk: Optional[PrivateResourceQuotaSDK] = None
|
111
113
|
) -> List[ResourceQuota]:
|
112
114
|
"""List resource quotas. """
|
113
|
-
return
|
115
|
+
return _private_sdk.list(name, cloud, creator_id, is_enabled, max_items,) # type: ignore
|
114
116
|
|
115
117
|
|
116
118
|
@sdk_command(
|
@@ -119,10 +121,12 @@ def list( # noqa: A001
|
|
119
121
|
doc_py_example=_DELETE_EXAMPLE,
|
120
122
|
arg_docstrings=_DELETE_DOCSTRINGS,
|
121
123
|
)
|
122
|
-
def delete(
|
124
|
+
def delete(
|
125
|
+
resource_quota_id: str, *, _private_sdk: Optional[PrivateResourceQuotaSDK] = None
|
126
|
+
):
|
123
127
|
"""Delete a resource quota.
|
124
128
|
"""
|
125
|
-
return
|
129
|
+
return _private_sdk.delete(resource_quota_id) # type: ignore
|
126
130
|
|
127
131
|
|
128
132
|
@sdk_command(
|
@@ -131,10 +135,12 @@ def delete(resource_quota_id: str, *, _sdk: PrivateResourceQuotaSDK):
|
|
131
135
|
doc_py_example=_ENABLE_EXAMPLE,
|
132
136
|
arg_docstrings=_ENABLE_DOCSTRINGS,
|
133
137
|
)
|
134
|
-
def enable(
|
138
|
+
def enable(
|
139
|
+
resource_quota_id: str, *, _private_sdk: Optional[PrivateResourceQuotaSDK] = None
|
140
|
+
):
|
135
141
|
"""Enable a resource quota.
|
136
142
|
"""
|
137
|
-
return
|
143
|
+
return _private_sdk.set_status(resource_quota_id, True) # type: ignore
|
138
144
|
|
139
145
|
|
140
146
|
@sdk_command(
|
@@ -143,7 +149,9 @@ def enable(resource_quota_id: str, *, _sdk: PrivateResourceQuotaSDK):
|
|
143
149
|
doc_py_example=_DISABLE_EXAMPLE,
|
144
150
|
arg_docstrings=_DISABLE_DOCSTRINGS,
|
145
151
|
)
|
146
|
-
def disable(
|
152
|
+
def disable(
|
153
|
+
resource_quota_id: str, *, _private_sdk: Optional[PrivateResourceQuotaSDK] = None
|
154
|
+
):
|
147
155
|
"""Disable a resource quota.
|
148
156
|
"""
|
149
|
-
return
|
157
|
+
return _private_sdk.set_status(resource_quota_id, False) # type: ignore
|
anyscale/schedule/commands.py
CHANGED
@@ -36,12 +36,14 @@ _APPLY_ARG_DOCSTRINGS = {"config": "The config options defining the schedule."}
|
|
36
36
|
doc_py_example=_APPLY_EXAMPLE,
|
37
37
|
arg_docstrings=_APPLY_ARG_DOCSTRINGS,
|
38
38
|
)
|
39
|
-
def apply(
|
39
|
+
def apply(
|
40
|
+
config: ScheduleConfig, *, _private_sdk: Optional[PrivateScheduleSDK] = None
|
41
|
+
) -> str:
|
40
42
|
"""Apply or update a schedule.
|
41
43
|
|
42
44
|
Returns the id of the schedule.
|
43
45
|
"""
|
44
|
-
return
|
46
|
+
return _private_sdk.apply(config) # type: ignore
|
45
47
|
|
46
48
|
|
47
49
|
_SET_STATE_EXAMPLE = """
|
@@ -76,13 +78,15 @@ def set_state(
|
|
76
78
|
cloud: Optional[str] = None,
|
77
79
|
project: Optional[str] = None,
|
78
80
|
state: ScheduleState,
|
79
|
-
|
81
|
+
_private_sdk: Optional[PrivateScheduleSDK] = None
|
80
82
|
) -> str:
|
81
83
|
"""Set the state of a schedule.
|
82
84
|
|
83
85
|
Returns the id of the schedule.
|
84
86
|
"""
|
85
|
-
return
|
87
|
+
return _private_sdk.set_state( # type: ignore
|
88
|
+
id=id, name=name, cloud=cloud, project=project, state=state,
|
89
|
+
)
|
86
90
|
|
87
91
|
|
88
92
|
_STATUS_EXAMPLE = """
|
@@ -110,11 +114,11 @@ def status(
|
|
110
114
|
name: Optional[str] = None,
|
111
115
|
cloud: Optional[str] = None,
|
112
116
|
project: Optional[str] = None,
|
113
|
-
|
117
|
+
_private_sdk: Optional[PrivateScheduleSDK] = None
|
114
118
|
) -> ScheduleStatus:
|
115
119
|
"""Return the status of the schedule.
|
116
120
|
"""
|
117
|
-
return
|
121
|
+
return _private_sdk.status(id=id, name=name, cloud=cloud, project=project) # type: ignore
|
118
122
|
|
119
123
|
|
120
124
|
_TRIGGER_EXAMPLE = """
|
@@ -142,8 +146,8 @@ def trigger(
|
|
142
146
|
name: Optional[str] = None,
|
143
147
|
cloud: Optional[str] = None,
|
144
148
|
project: Optional[str] = None,
|
145
|
-
|
149
|
+
_private_sdk: Optional[PrivateScheduleSDK] = None
|
146
150
|
) -> str:
|
147
151
|
"""Trigger the execution of the schedule.
|
148
152
|
"""
|
149
|
-
return
|
153
|
+
return _private_sdk.trigger(id=id, name=name, cloud=cloud, project=project) # type: ignore
|
@@ -68,7 +68,7 @@ def _upload_and_rewrite_working_dir_in_create_production_job(create_production_j
|
|
68
68
|
|
69
69
|
def _upload_and_rewrite_working_dir_ray_serve_config(
|
70
70
|
ray_serve_config: Optional[Dict[str, Any]]
|
71
|
-
) -> Dict[str, Any]:
|
71
|
+
) -> Optional[Dict[str, Any]]:
|
72
72
|
"""
|
73
73
|
If a local working_dir and upload_path are specified, this method
|
74
74
|
will upload the working_dir and rewrites the working_dir to the remote uri.
|
@@ -159,7 +159,7 @@ class AnyscaleSDK(DefaultApi): # type: ignore
|
|
159
159
|
poll_rate_seconds: int = 15,
|
160
160
|
timeout_seconds: Optional[int] = None,
|
161
161
|
log_output: bool = False,
|
162
|
-
) -> ClusterEnvironmentBuild:
|
162
|
+
) -> Optional[ClusterEnvironmentBuild]:
|
163
163
|
"""
|
164
164
|
Creates a new Cluster Environment and waits for build to complete.
|
165
165
|
|
@@ -199,7 +199,7 @@ class AnyscaleSDK(DefaultApi): # type: ignore
|
|
199
199
|
correct_base_image_name = get_correct_name_for_base_image_name(base_image_name)
|
200
200
|
if base_image_name != correct_base_image_name: # We need to make sure base_image_name after ray 2.7.0, before 2.8.0 have a optimized suffix
|
201
201
|
self.log.error(f"Starting from Ray version 2.7.0 and before version 2.8.0, you might be required to include the suffix 'optimized' in the base_image name for that specific Ray version. Try using {self.log.highlight(correct_base_image_name)}")
|
202
|
-
return
|
202
|
+
return # type: ignore
|
203
203
|
cluster_environment = self.create_cluster_environment(
|
204
204
|
create_cluster_environment
|
205
205
|
).result
|
@@ -224,7 +224,7 @@ class AnyscaleSDK(DefaultApi): # type: ignore
|
|
224
224
|
correct_base_image_name = get_correct_name_for_base_image_name(base_image_name)
|
225
225
|
if base_image_name != correct_base_image_name: # We need to make sure base_image_name after ray 2.7.0, before 2.8.0 have a optimized suffix
|
226
226
|
self.log.error(f"Starting from Ray version 2.7.0 and before version 2.8.0, you might be required to include the suffix 'optimized' in the base_image name for that specific Ray version. Try using {self.log.highlight(correct_base_image_name)}")
|
227
|
-
return
|
227
|
+
return # type: ignore
|
228
228
|
build = self.create_cluster_environment_build(
|
229
229
|
{
|
230
230
|
"cluster_environment_id": cluster_environment.id,
|
@@ -477,6 +477,7 @@ class AnyscaleSDK(DefaultApi): # type: ignore
|
|
477
477
|
create_cluster_environment, poll_rate_seconds, timeout_seconds
|
478
478
|
)
|
479
479
|
|
480
|
+
assert cluster_environment_build is not None
|
480
481
|
return self.launch_cluster(
|
481
482
|
project_id,
|
482
483
|
cluster_name,
|
anyscale/service/commands.py
CHANGED
@@ -48,7 +48,7 @@ def deploy(
|
|
48
48
|
in_place: bool = False,
|
49
49
|
canary_percent: Optional[int] = None,
|
50
50
|
max_surge_percent: Optional[int] = None,
|
51
|
-
|
51
|
+
_private_sdk: Optional[PrivateServiceSDK] = None,
|
52
52
|
) -> str:
|
53
53
|
"""Deploy a service.
|
54
54
|
|
@@ -58,7 +58,7 @@ def deploy(
|
|
58
58
|
|
59
59
|
Returns the id of the deployed service.
|
60
60
|
"""
|
61
|
-
return
|
61
|
+
return _private_sdk.deploy( # type: ignore
|
62
62
|
config,
|
63
63
|
in_place=in_place,
|
64
64
|
canary_percent=canary_percent,
|
@@ -92,7 +92,7 @@ def rollback(
|
|
92
92
|
cloud: Optional[str] = None,
|
93
93
|
project: Optional[str] = None,
|
94
94
|
max_surge_percent: Optional[int] = None,
|
95
|
-
|
95
|
+
_private_sdk: Optional[PrivateServiceSDK] = None,
|
96
96
|
) -> str:
|
97
97
|
"""Rollback to the primary version of the service.
|
98
98
|
|
@@ -103,7 +103,7 @@ def rollback(
|
|
103
103
|
|
104
104
|
Returns the id of the rolled back service.
|
105
105
|
"""
|
106
|
-
return
|
106
|
+
return _private_sdk.rollback( # type: ignore
|
107
107
|
name=name, cloud=cloud, project=project, max_surge_percent=max_surge_percent
|
108
108
|
)
|
109
109
|
|
@@ -132,7 +132,7 @@ def terminate(
|
|
132
132
|
*,
|
133
133
|
cloud: Optional[str] = None,
|
134
134
|
project: Optional[str] = None,
|
135
|
-
|
135
|
+
_private_sdk: Optional[PrivateServiceSDK] = None,
|
136
136
|
) -> str:
|
137
137
|
"""Terminate a service.
|
138
138
|
|
@@ -140,7 +140,7 @@ def terminate(
|
|
140
140
|
|
141
141
|
Returns the id of the terminated service.
|
142
142
|
"""
|
143
|
-
return
|
143
|
+
return _private_sdk.terminate(name=name, cloud=cloud, project=project) # type: ignore
|
144
144
|
|
145
145
|
|
146
146
|
_ARCHIVE_EXAMPLE = """
|
@@ -169,7 +169,7 @@ def archive(
|
|
169
169
|
*,
|
170
170
|
cloud: Optional[str] = None,
|
171
171
|
project: Optional[str] = None,
|
172
|
-
|
172
|
+
_private_sdk: Optional[PrivateServiceSDK] = None,
|
173
173
|
) -> str:
|
174
174
|
"""Archive a service.
|
175
175
|
|
@@ -177,7 +177,7 @@ def archive(
|
|
177
177
|
|
178
178
|
Returns the ID of the archived service.
|
179
179
|
"""
|
180
|
-
return
|
180
|
+
return _private_sdk.archive(id=id, name=name, cloud=cloud, project=project) # type: ignore
|
181
181
|
|
182
182
|
|
183
183
|
_DELETE_EXAMPLE = """
|
@@ -206,7 +206,7 @@ def delete(
|
|
206
206
|
*,
|
207
207
|
cloud: Optional[str] = None,
|
208
208
|
project: Optional[str] = None,
|
209
|
-
|
209
|
+
_private_sdk: Optional[PrivateServiceSDK] = None,
|
210
210
|
) -> str:
|
211
211
|
"""Delete a service.
|
212
212
|
|
@@ -214,7 +214,7 @@ def delete(
|
|
214
214
|
|
215
215
|
Returns the ID of the deleted service.
|
216
216
|
"""
|
217
|
-
return
|
217
|
+
return _private_sdk.delete(id=id, name=name, cloud=cloud, project=project) # type: ignore
|
218
218
|
|
219
219
|
|
220
220
|
_STATUS_EXAMPLE = """
|
@@ -242,10 +242,10 @@ def status(
|
|
242
242
|
*,
|
243
243
|
cloud: Optional[str] = None,
|
244
244
|
project: Optional[str] = None,
|
245
|
-
|
245
|
+
_private_sdk: Optional[PrivateServiceSDK] = None,
|
246
246
|
) -> ServiceStatus:
|
247
247
|
"""Get the status of a service."""
|
248
|
-
return
|
248
|
+
return _private_sdk.status(name=name, cloud=cloud, project=project) # type: ignore
|
249
249
|
|
250
250
|
|
251
251
|
_WAIT_EXAMPLE = """
|
@@ -277,18 +277,18 @@ def wait(
|
|
277
277
|
project: Optional[str] = None,
|
278
278
|
state: Union[str, ServiceState] = ServiceState.RUNNING,
|
279
279
|
timeout_s: float = 600,
|
280
|
-
|
280
|
+
_private_sdk: Optional[PrivateServiceSDK] = None,
|
281
281
|
_interval_s: float = 5,
|
282
282
|
):
|
283
283
|
"""Wait for a service to reach a target state."""
|
284
|
-
|
284
|
+
_private_sdk.wait( # type: ignore
|
285
285
|
name=name,
|
286
286
|
cloud=cloud,
|
287
287
|
project=project,
|
288
288
|
state=ServiceState(state),
|
289
289
|
timeout_s=timeout_s,
|
290
290
|
interval_s=_interval_s,
|
291
|
-
)
|
291
|
+
) # type: ignore
|
292
292
|
|
293
293
|
|
294
294
|
_CONTROLLER_LOGS_EXAMPLE = """
|
@@ -322,10 +322,10 @@ def _controller_logs(
|
|
322
322
|
canary: bool = False,
|
323
323
|
mode: Union[str, ServiceLogMode] = ServiceLogMode.TAIL,
|
324
324
|
max_lines: int = 1000,
|
325
|
-
|
325
|
+
_private_sdk: Optional[PrivateServiceSDK] = None,
|
326
326
|
):
|
327
327
|
"""Wait for a service to reach a target state."""
|
328
|
-
return
|
328
|
+
return _private_sdk.controller_logs( # type: ignore
|
329
329
|
name,
|
330
330
|
cloud=cloud,
|
331
331
|
project=project,
|
@@ -77,10 +77,12 @@ _ROTATE_API_KEYS_DOCSTRINGS = {
|
|
77
77
|
doc_py_example=_CREATE_EXAMPLE,
|
78
78
|
arg_docstrings=_CREATE_DOCSTRINGS,
|
79
79
|
)
|
80
|
-
def create(
|
80
|
+
def create(
|
81
|
+
name: str, *, _private_sdk: Optional[PrivateServiceAccountSDK] = None
|
82
|
+
) -> str:
|
81
83
|
"""Create a service account and return the API key.
|
82
84
|
"""
|
83
|
-
return
|
85
|
+
return _private_sdk.create(name) # type: ignore
|
84
86
|
|
85
87
|
|
86
88
|
@sdk_command(
|
@@ -93,11 +95,11 @@ def create_api_key(
|
|
93
95
|
email: Optional[str] = None,
|
94
96
|
name: Optional[str] = None,
|
95
97
|
*,
|
96
|
-
|
98
|
+
_private_sdk: Optional[PrivateServiceAccountSDK] = None
|
97
99
|
) -> str:
|
98
100
|
"""Create an API key for the service account and return the API key.
|
99
101
|
"""
|
100
|
-
return
|
102
|
+
return _private_sdk.create_api_key(email, name) # type: ignore
|
101
103
|
|
102
104
|
|
103
105
|
@sdk_command(
|
@@ -107,10 +109,10 @@ def create_api_key(
|
|
107
109
|
arg_docstrings=_LIST_DOCSTRINGS,
|
108
110
|
)
|
109
111
|
def list( # noqa: A001
|
110
|
-
max_items: int = 20, *,
|
112
|
+
max_items: int = 20, *, _private_sdk: Optional[PrivateServiceAccountSDK] = None
|
111
113
|
) -> List[ServiceAccount]:
|
112
114
|
"""List service accounts. """
|
113
|
-
return
|
115
|
+
return _private_sdk.list(max_items) # type: ignore
|
114
116
|
|
115
117
|
|
116
118
|
@sdk_command(
|
@@ -123,11 +125,11 @@ def delete(
|
|
123
125
|
email: Optional[str] = None,
|
124
126
|
name: Optional[str] = None,
|
125
127
|
*,
|
126
|
-
|
128
|
+
_private_sdk: Optional[PrivateServiceAccountSDK] = None
|
127
129
|
):
|
128
130
|
"""Delete a service account.
|
129
131
|
"""
|
130
|
-
return
|
132
|
+
return _private_sdk.delete(email, name) # type: ignore
|
131
133
|
|
132
134
|
|
133
135
|
@sdk_command(
|
@@ -140,8 +142,8 @@ def rotate_api_keys(
|
|
140
142
|
email: Optional[str] = None,
|
141
143
|
name: Optional[str] = None,
|
142
144
|
*,
|
143
|
-
|
145
|
+
_private_sdk: Optional[PrivateServiceAccountSDK] = None
|
144
146
|
) -> str:
|
145
147
|
"""Rotate all api keys of a service account and return the new API key.
|
146
148
|
"""
|
147
|
-
return
|
149
|
+
return _private_sdk.rotate_api_keys(email, name) # type: ignore
|
anyscale/user/commands.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import List
|
1
|
+
from typing import List, Optional
|
2
2
|
|
3
3
|
from anyscale._private.sdk import sdk_command
|
4
4
|
from anyscale.user._private.user_sdk import PrivateUserSDK
|
@@ -35,8 +35,10 @@ _ADMIN_BATCH_CREATE_ARG_DOCSTRINGS = {
|
|
35
35
|
arg_docstrings=_ADMIN_BATCH_CREATE_ARG_DOCSTRINGS,
|
36
36
|
)
|
37
37
|
def admin_batch_create(
|
38
|
-
admin_create_users: List[AdminCreateUser],
|
38
|
+
admin_create_users: List[AdminCreateUser],
|
39
|
+
*,
|
40
|
+
_private_sdk: Optional[PrivateUserSDK] = None
|
39
41
|
) -> List[AdminCreatedUser]:
|
40
42
|
"""Batch create, as an admin, users without email verification.
|
41
43
|
"""
|
42
|
-
return
|
44
|
+
return _private_sdk.admin_batch_create(admin_create_users) # type: ignore
|