anyscale 0.24.88__py3-none-any.whl → 0.25.5__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/__init__.py +56 -0
- anyscale/_private/anyscale_client/anyscale_client.py +179 -28
- anyscale/_private/anyscale_client/common.py +109 -2
- anyscale/_private/anyscale_client/fake_anyscale_client.py +239 -1
- anyscale/_private/docgen/README.md +1 -1
- anyscale/_private/docgen/__main__.py +71 -21
- anyscale/_private/docgen/api.md +13 -20
- anyscale/_private/docgen/generator.py +3 -2
- anyscale/_private/docgen/models.md +4 -49
- anyscale/_private/workload/workload_config.py +21 -7
- anyscale/aggregated_instance_usage/__init__.py +1 -1
- anyscale/aggregated_instance_usage/commands.py +2 -4
- anyscale/aggregated_instance_usage/models.py +8 -8
- anyscale/client/README.md +25 -22
- anyscale/client/openapi_client/__init__.py +16 -14
- anyscale/client/openapi_client/api/default_api.py +1139 -959
- anyscale/client/openapi_client/models/__init__.py +16 -14
- anyscale/client/openapi_client/models/baseimagesenum.py +43 -1
- anyscale/client/openapi_client/models/{session_event_types.py → cloud_deployment_config.py} +35 -24
- anyscale/client/openapi_client/models/{platformfinetuningjob_response.py → clouddeploymentconfig_response.py} +11 -11
- anyscale/client/openapi_client/models/{log_level_types.py → cluster_event_source.py} +12 -7
- anyscale/client/openapi_client/models/{company_size.py → cluster_size.py} +10 -10
- anyscale/client/openapi_client/models/cluster_status_details.py +2 -1
- anyscale/client/openapi_client/models/{sessionevent_list_response.py → clusterevent_list_response.py} +15 -15
- anyscale/client/openapi_client/models/create_experimental_workspace.py +29 -1
- anyscale/client/openapi_client/models/create_notification_channel_record.py +29 -3
- anyscale/client/openapi_client/models/decorated_interactive_session.py +1 -57
- anyscale/client/openapi_client/models/decorated_job.py +1 -57
- anyscale/client/openapi_client/models/decorated_job_submission.py +1 -29
- anyscale/client/openapi_client/models/decorated_production_job.py +1 -29
- anyscale/client/openapi_client/models/decorated_session.py +1 -57
- anyscale/client/openapi_client/models/decorated_unified_job.py +1 -30
- anyscale/client/openapi_client/models/{resubmit_ft_job_request.py → describe_machine_pool_request.py} +21 -20
- anyscale/client/openapi_client/models/describe_machine_pool_response.py +123 -0
- anyscale/client/openapi_client/models/describemachinepoolresponse_response.py +121 -0
- anyscale/client/openapi_client/models/ha_jobs_sort_field.py +1 -2
- anyscale/client/openapi_client/models/internal_production_job.py +1 -29
- anyscale/client/openapi_client/models/jobs_sort_field.py +1 -2
- anyscale/client/openapi_client/models/machine_allocation_state.py +3 -1
- anyscale/client/openapi_client/models/machine_state_info.py +326 -0
- anyscale/client/openapi_client/models/{fine_tuning_job_status.py → notification_channel_slack_config.py} +34 -16
- anyscale/client/openapi_client/models/organization_marketing_questions.py +80 -54
- anyscale/client/openapi_client/models/request_state_info.py +210 -0
- anyscale/client/openapi_client/models/{platformfinetuningjob_list_response.py → scheduler_info.py} +43 -38
- anyscale/client/openapi_client/models/serve_deployment_fast_api_docs_status.py +123 -0
- anyscale/client/openapi_client/models/serve_deployment_state.py +2 -1
- anyscale/client/openapi_client/models/servedeploymentfastapidocsstatus_response.py +121 -0
- anyscale/client/openapi_client/models/sessions_sort_field.py +1 -2
- anyscale/client/openapi_client/models/supportedbaseimagesenum.py +43 -1
- anyscale/client/openapi_client/models/unified_job_sort_field.py +1 -2
- anyscale/client/openapi_client/models/update_cloud_collaborator.py +121 -0
- anyscale/client/openapi_client/models/usage_by_cluster.py +28 -1
- anyscale/client/openapi_client/models/usage_by_user.py +30 -3
- anyscale/client/openapi_client/models/workload_info.py +210 -0
- anyscale/cloud/__init__.py +83 -0
- anyscale/cloud/_private/cloud_sdk.py +25 -0
- anyscale/cloud/commands.py +45 -0
- anyscale/cloud/models.py +91 -0
- anyscale/cluster_compute.py +1 -1
- anyscale/commands/aggregated_instance_usage_commands.py +4 -4
- anyscale/commands/cloud_commands.py +87 -14
- anyscale/commands/command_examples.py +65 -0
- anyscale/commands/job_commands.py +15 -3
- anyscale/commands/machine_pool_commands.py +113 -1
- anyscale/commands/organization_invitation_commands.py +98 -0
- anyscale/commands/project_commands.py +52 -2
- anyscale/commands/resource_quota_commands.py +98 -11
- anyscale/commands/service_account_commands.py +65 -8
- anyscale/commands/service_commands.py +61 -1
- anyscale/commands/session_commands_hidden.py +5 -1
- anyscale/commands/user_commands.py +1 -1
- anyscale/commands/util.py +2 -2
- anyscale/commands/workspace_commands.py +1 -1
- anyscale/connect.py +1 -1
- anyscale/connect_utils/project.py +7 -4
- anyscale/controllers/cloud_controller.py +63 -30
- anyscale/controllers/cloud_functional_verification_controller.py +1 -1
- anyscale/controllers/cluster_controller.py +3 -11
- anyscale/controllers/compute_config_controller.py +1 -1
- anyscale/controllers/experimental_integrations_controller.py +1 -1
- anyscale/controllers/job_controller.py +8 -6
- anyscale/controllers/list_controller.py +2 -2
- anyscale/controllers/machine_pool_controller.py +12 -1
- anyscale/controllers/project_controller.py +4 -3
- anyscale/controllers/schedule_controller.py +1 -1
- anyscale/controllers/service_controller.py +1 -1
- anyscale/controllers/workspace_controller.py +1 -1
- anyscale/models/job_model.py +1 -1
- anyscale/organization_invitation/__init__.py +61 -0
- anyscale/organization_invitation/_private/organization_invitation_sdk.py +24 -0
- anyscale/organization_invitation/commands.py +84 -0
- anyscale/organization_invitation/models.py +45 -0
- anyscale/project/__init__.py +35 -0
- anyscale/project/_private/project_sdk.py +27 -0
- anyscale/project/commands.py +56 -0
- anyscale/project/models.py +91 -0
- anyscale/{project.py → project_utils.py} +3 -4
- anyscale/resource_quota/__init__.py +99 -0
- anyscale/resource_quota/_private/resource_quota_sdk.py +120 -0
- anyscale/resource_quota/commands.py +150 -0
- anyscale/resource_quota/models.py +303 -0
- anyscale/scripts.py +4 -0
- anyscale/sdk/anyscale_client/__init__.py +0 -5
- anyscale/sdk/anyscale_client/api/default_api.py +119 -150
- anyscale/sdk/anyscale_client/models/__init__.py +0 -5
- anyscale/sdk/anyscale_client/models/baseimagesenum.py +43 -1
- anyscale/sdk/anyscale_client/models/cluster_status_details.py +2 -1
- anyscale/sdk/anyscale_client/models/jobs_sort_field.py +1 -2
- anyscale/sdk/anyscale_client/models/supportedbaseimagesenum.py +43 -1
- anyscale/sdk/anyscale_client/sdk.py +1 -1
- anyscale/service/__init__.py +21 -0
- anyscale/service/_private/service_sdk.py +13 -0
- anyscale/service/commands.py +35 -0
- anyscale/service_account/__init__.py +88 -0
- anyscale/service_account/_private/service_account_sdk.py +101 -0
- anyscale/service_account/commands.py +147 -0
- anyscale/service_account/models.py +66 -0
- anyscale/shared_anyscale_utils/latest_ray_version.py +1 -1
- anyscale/shared_anyscale_utils/utils/id_gen.py +2 -0
- anyscale/user/__init__.py +1 -1
- anyscale/user/commands.py +1 -1
- anyscale/user/models.py +25 -15
- anyscale/util.py +23 -0
- anyscale/utils/cloud_utils.py +1 -1
- anyscale/version.py +1 -1
- anyscale/workspace_utils.py +1 -1
- {anyscale-0.24.88.dist-info → anyscale-0.25.5.dist-info}/METADATA +1 -5
- {anyscale-0.24.88.dist-info → anyscale-0.25.5.dist-info}/RECORD +134 -119
- anyscale/client/openapi_client/models/create_fine_tuning_hyperparameters.py +0 -156
- anyscale/client/openapi_client/models/create_fine_tuning_job_product_request.py +0 -353
- anyscale/client/openapi_client/models/finish_ft_job_request.py +0 -204
- anyscale/client/openapi_client/models/platform_fine_tuning_job.py +0 -577
- anyscale/client/openapi_client/models/session_event.py +0 -267
- anyscale/client/openapi_client/models/session_event_cause.py +0 -150
- anyscale/controllers/resource_quota_controller.py +0 -183
- anyscale/controllers/service_account_controller.py +0 -168
- anyscale/sdk/anyscale_client/models/log_level_types.py +0 -100
- anyscale/sdk/anyscale_client/models/session_event.py +0 -267
- anyscale/sdk/anyscale_client/models/session_event_cause.py +0 -150
- anyscale/sdk/anyscale_client/models/session_event_types.py +0 -111
- anyscale/sdk/anyscale_client/models/sessionevent_list_response.py +0 -147
- anyscale/utils/imports/azure.py +0 -14
- /anyscale/{cloud.py → cloud_utils.py} +0 -0
- {anyscale-0.24.88.dist-info → anyscale-0.25.5.dist-info}/LICENSE +0 -0
- {anyscale-0.24.88.dist-info → anyscale-0.25.5.dist-info}/NOTICE +0 -0
- {anyscale-0.24.88.dist-info → anyscale-0.25.5.dist-info}/WHEEL +0 -0
- {anyscale-0.24.88.dist-info → anyscale-0.25.5.dist-info}/entry_points.txt +0 -0
- {anyscale-0.24.88.dist-info → anyscale-0.25.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
from typing import List, Optional
|
2
|
+
|
3
|
+
from anyscale._private.sdk.base_sdk import BaseSDK
|
4
|
+
from anyscale.client.openapi_client.models.create_resource_quota import (
|
5
|
+
CreateResourceQuota as CreateResourceQuotaModel,
|
6
|
+
)
|
7
|
+
from anyscale.client.openapi_client.models.quota import Quota as QuotaModel
|
8
|
+
from anyscale.resource_quota.models import CreateResourceQuota, Quota, ResourceQuota
|
9
|
+
|
10
|
+
|
11
|
+
class PrivateResourceQuotaSDK(BaseSDK):
|
12
|
+
def create(self, create_resource_quota: CreateResourceQuota) -> ResourceQuota:
|
13
|
+
cloud_id = self.client.get_cloud_id(
|
14
|
+
cloud_name=create_resource_quota.cloud, compute_config_id=None
|
15
|
+
)
|
16
|
+
|
17
|
+
project_id = (
|
18
|
+
self.client.get_project_id(
|
19
|
+
parent_cloud_id=cloud_id, name=create_resource_quota.project
|
20
|
+
)
|
21
|
+
if create_resource_quota.project
|
22
|
+
else None
|
23
|
+
)
|
24
|
+
|
25
|
+
user_id = None
|
26
|
+
if create_resource_quota.user_email:
|
27
|
+
users = self.client.get_organization_collaborators(
|
28
|
+
email=create_resource_quota.user_email
|
29
|
+
)
|
30
|
+
|
31
|
+
if len(users) == 0:
|
32
|
+
raise ValueError(
|
33
|
+
f"User with email '{create_resource_quota.user_email}' not found."
|
34
|
+
)
|
35
|
+
|
36
|
+
if len(users) > 1:
|
37
|
+
raise ValueError(
|
38
|
+
f"Multiple users found for email '{create_resource_quota.user_email}'. Please contact Anyscale support."
|
39
|
+
)
|
40
|
+
user_id = users[0].user_id
|
41
|
+
|
42
|
+
create_resource_quota_model = CreateResourceQuotaModel(
|
43
|
+
name=create_resource_quota.name,
|
44
|
+
cloud_id=cloud_id,
|
45
|
+
project_id=project_id,
|
46
|
+
user_id=user_id,
|
47
|
+
quota=QuotaModel(
|
48
|
+
num_cpus=create_resource_quota.num_cpus,
|
49
|
+
num_instances=create_resource_quota.num_instances,
|
50
|
+
num_gpus=create_resource_quota.num_gpus,
|
51
|
+
num_accelerators=create_resource_quota.num_accelerators,
|
52
|
+
),
|
53
|
+
)
|
54
|
+
|
55
|
+
resource_quota = self.client.create_resource_quota(
|
56
|
+
create_resource_quota=create_resource_quota_model
|
57
|
+
)
|
58
|
+
|
59
|
+
return ResourceQuota(
|
60
|
+
id=resource_quota.id,
|
61
|
+
name=resource_quota.name,
|
62
|
+
cloud_id=resource_quota.cloud_id,
|
63
|
+
project_id=resource_quota.project_id,
|
64
|
+
user_id=resource_quota.user_id,
|
65
|
+
is_enabled=resource_quota.is_enabled,
|
66
|
+
created_at=resource_quota.created_at,
|
67
|
+
deleted_at=resource_quota.deleted_at,
|
68
|
+
quota=Quota(
|
69
|
+
num_cpus=resource_quota.quota.num_cpus,
|
70
|
+
num_instances=resource_quota.quota.num_instances,
|
71
|
+
num_gpus=resource_quota.quota.num_gpus,
|
72
|
+
num_accelerators=resource_quota.quota.num_accelerators,
|
73
|
+
),
|
74
|
+
)
|
75
|
+
|
76
|
+
def list(
|
77
|
+
self,
|
78
|
+
name: Optional[str] = None,
|
79
|
+
cloud: Optional[str] = None,
|
80
|
+
creator_id: Optional[str] = None,
|
81
|
+
is_enabled: Optional[bool] = None,
|
82
|
+
max_items: int = 20,
|
83
|
+
) -> List[ResourceQuota]:
|
84
|
+
cloud_id = (
|
85
|
+
self.client.get_cloud_id(cloud_name=cloud, compute_config_id=None)
|
86
|
+
if cloud
|
87
|
+
else None
|
88
|
+
)
|
89
|
+
|
90
|
+
resource_quotas = self.client.list_resource_quotas(
|
91
|
+
name, cloud_id, creator_id, is_enabled, max_items,
|
92
|
+
)
|
93
|
+
|
94
|
+
return [
|
95
|
+
ResourceQuota(
|
96
|
+
id=resource_quota.id,
|
97
|
+
name=resource_quota.name,
|
98
|
+
cloud_id=resource_quota.cloud_id,
|
99
|
+
project_id=resource_quota.project_id,
|
100
|
+
user_id=resource_quota.user_id,
|
101
|
+
is_enabled=resource_quota.is_enabled,
|
102
|
+
created_at=resource_quota.created_at,
|
103
|
+
deleted_at=resource_quota.deleted_at,
|
104
|
+
quota=Quota(
|
105
|
+
num_cpus=resource_quota.quota.num_cpus,
|
106
|
+
num_instances=resource_quota.quota.num_instances,
|
107
|
+
num_gpus=resource_quota.quota.num_gpus,
|
108
|
+
num_accelerators=resource_quota.quota.num_accelerators,
|
109
|
+
),
|
110
|
+
)
|
111
|
+
for resource_quota in resource_quotas
|
112
|
+
]
|
113
|
+
|
114
|
+
def delete(self, resource_quota_id: str) -> None:
|
115
|
+
self.client.delete_resource_quota(resource_quota_id=resource_quota_id)
|
116
|
+
|
117
|
+
def set_status(self, resource_quota_id: str, is_enabled: bool) -> None:
|
118
|
+
self.client.set_resource_quota_status(
|
119
|
+
resource_quota_id=resource_quota_id, is_enabled=is_enabled
|
120
|
+
)
|
@@ -0,0 +1,150 @@
|
|
1
|
+
from typing import List, Optional
|
2
|
+
|
3
|
+
from anyscale._private.sdk import sdk_command
|
4
|
+
from anyscale.resource_quota._private.resource_quota_sdk import PrivateResourceQuotaSDK
|
5
|
+
from anyscale.resource_quota.models import CreateResourceQuota, ResourceQuota
|
6
|
+
|
7
|
+
|
8
|
+
_RESOURCE_QUOTA_SDK_SINGLETON_KEY = "resource_quota_sdk"
|
9
|
+
|
10
|
+
_CREATE_EXAMPLE = """
|
11
|
+
import anyscale
|
12
|
+
from anyscale.resource_quota.models import CreateResourceQuota
|
13
|
+
|
14
|
+
anyscale.resource_quota.create(
|
15
|
+
ResourceQuota(
|
16
|
+
name="my-resource-quota",
|
17
|
+
cloud="my-cloud",
|
18
|
+
project="my-project",
|
19
|
+
num_cpus=2,
|
20
|
+
),
|
21
|
+
)
|
22
|
+
"""
|
23
|
+
|
24
|
+
_CREATE_DOCSTRINGS = {"create_resource_quota": "The resource quota to be created."}
|
25
|
+
|
26
|
+
_LIST_EXAMPLE = """
|
27
|
+
import anyscale
|
28
|
+
from anyscale.resource_quota.models import CreateResourceQuota
|
29
|
+
|
30
|
+
anyscale.resource_quota.list(
|
31
|
+
name="my-resource-quota",
|
32
|
+
cloud="my-cloud",
|
33
|
+
creator_id="usr_123",
|
34
|
+
is_enabled=True,
|
35
|
+
max_items=20,
|
36
|
+
)
|
37
|
+
"""
|
38
|
+
|
39
|
+
_LIST_DOCSTRINGS = {
|
40
|
+
"name": "Name of the resource quota.",
|
41
|
+
"cloud": "Name of the cloud that this resource quota applies to.",
|
42
|
+
"creator_id": "ID of the creator of the resource quota.",
|
43
|
+
"is_enabled": "Whether the resource quota is enabled.",
|
44
|
+
"max_items": "Maximum number of items to return.",
|
45
|
+
}
|
46
|
+
|
47
|
+
_DELETE_EXAMPLE = """
|
48
|
+
import anyscale
|
49
|
+
|
50
|
+
anyscale.resource_quota.delete(
|
51
|
+
resource_quota_id="rq_123",
|
52
|
+
)
|
53
|
+
"""
|
54
|
+
|
55
|
+
_DELETE_DOCSTRINGS = {
|
56
|
+
"resource_quota_id": "ID of the resource quota to delete.",
|
57
|
+
}
|
58
|
+
|
59
|
+
_ENABLE_EXAMPLE = """
|
60
|
+
import anyscale
|
61
|
+
|
62
|
+
anyscale.resource_quota.enable(
|
63
|
+
resource_quota_id="rq_123",
|
64
|
+
)
|
65
|
+
"""
|
66
|
+
|
67
|
+
_ENABLE_DOCSTRINGS = {
|
68
|
+
"resource_quota_id": "ID of the resource quota to enable.",
|
69
|
+
}
|
70
|
+
|
71
|
+
_DISABLE_EXAMPLE = """
|
72
|
+
import anyscale
|
73
|
+
|
74
|
+
anyscale.resource_quota.disable(
|
75
|
+
resource_quota_id="rq_123",
|
76
|
+
)
|
77
|
+
"""
|
78
|
+
|
79
|
+
_DISABLE_DOCSTRINGS = {
|
80
|
+
"resource_quota_id": "ID of the resource quota to disable.",
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
@sdk_command(
|
85
|
+
_RESOURCE_QUOTA_SDK_SINGLETON_KEY,
|
86
|
+
PrivateResourceQuotaSDK,
|
87
|
+
doc_py_example=_CREATE_EXAMPLE,
|
88
|
+
arg_docstrings=_CREATE_DOCSTRINGS,
|
89
|
+
)
|
90
|
+
def create(
|
91
|
+
create_resource_quota: CreateResourceQuota, *, _sdk: PrivateResourceQuotaSDK
|
92
|
+
) -> ResourceQuota:
|
93
|
+
"""Create a resource quota.
|
94
|
+
"""
|
95
|
+
return _sdk.create(create_resource_quota)
|
96
|
+
|
97
|
+
|
98
|
+
@sdk_command(
|
99
|
+
_RESOURCE_QUOTA_SDK_SINGLETON_KEY,
|
100
|
+
PrivateResourceQuotaSDK,
|
101
|
+
doc_py_example=_LIST_EXAMPLE,
|
102
|
+
arg_docstrings=_LIST_DOCSTRINGS,
|
103
|
+
)
|
104
|
+
def list( # noqa: A001
|
105
|
+
name: Optional[str] = None,
|
106
|
+
cloud: Optional[str] = None,
|
107
|
+
creator_id: Optional[str] = None,
|
108
|
+
is_enabled: Optional[bool] = None,
|
109
|
+
max_items: int = 20,
|
110
|
+
*,
|
111
|
+
_sdk: PrivateResourceQuotaSDK
|
112
|
+
) -> List[ResourceQuota]:
|
113
|
+
"""List resource quotas. """
|
114
|
+
return _sdk.list(name, cloud, creator_id, is_enabled, max_items,)
|
115
|
+
|
116
|
+
|
117
|
+
@sdk_command(
|
118
|
+
_RESOURCE_QUOTA_SDK_SINGLETON_KEY,
|
119
|
+
PrivateResourceQuotaSDK,
|
120
|
+
doc_py_example=_DELETE_EXAMPLE,
|
121
|
+
arg_docstrings=_DELETE_DOCSTRINGS,
|
122
|
+
)
|
123
|
+
def delete(resource_quota_id: str, *, _sdk: PrivateResourceQuotaSDK):
|
124
|
+
"""Delete a resource quota.
|
125
|
+
"""
|
126
|
+
return _sdk.delete(resource_quota_id)
|
127
|
+
|
128
|
+
|
129
|
+
@sdk_command(
|
130
|
+
_RESOURCE_QUOTA_SDK_SINGLETON_KEY,
|
131
|
+
PrivateResourceQuotaSDK,
|
132
|
+
doc_py_example=_ENABLE_EXAMPLE,
|
133
|
+
arg_docstrings=_ENABLE_DOCSTRINGS,
|
134
|
+
)
|
135
|
+
def enable(resource_quota_id: str, *, _sdk: PrivateResourceQuotaSDK):
|
136
|
+
"""Enable a resource quota.
|
137
|
+
"""
|
138
|
+
return _sdk.set_status(resource_quota_id, True)
|
139
|
+
|
140
|
+
|
141
|
+
@sdk_command(
|
142
|
+
_RESOURCE_QUOTA_SDK_SINGLETON_KEY,
|
143
|
+
PrivateResourceQuotaSDK,
|
144
|
+
doc_py_example=_DISABLE_EXAMPLE,
|
145
|
+
arg_docstrings=_DISABLE_DOCSTRINGS,
|
146
|
+
)
|
147
|
+
def disable(resource_quota_id: str, *, _sdk: PrivateResourceQuotaSDK):
|
148
|
+
"""Disable a resource quota.
|
149
|
+
"""
|
150
|
+
return _sdk.set_status(resource_quota_id, False)
|
@@ -0,0 +1,303 @@
|
|
1
|
+
from dataclasses import dataclass, field
|
2
|
+
from datetime import datetime
|
3
|
+
from typing import Dict, Optional
|
4
|
+
|
5
|
+
from anyscale._private.models import ModelBase
|
6
|
+
|
7
|
+
|
8
|
+
@dataclass(frozen=True)
|
9
|
+
class CreateResourceQuota(ModelBase):
|
10
|
+
"""Resource quota creation model.
|
11
|
+
"""
|
12
|
+
|
13
|
+
__doc_py_example__ = """\
|
14
|
+
import anyscale
|
15
|
+
from anyscale.resource_quota.models import CreateResourceQuota
|
16
|
+
|
17
|
+
create_resource_quota = CreateResourceQuota(
|
18
|
+
# Name of the resource quota to create
|
19
|
+
name="resource_quota_name",
|
20
|
+
# Name of the cloud that this resource quota applies to
|
21
|
+
cloud="cloud_name",
|
22
|
+
# Name of the project that this resource quota applies to (optional)
|
23
|
+
project="project_name",
|
24
|
+
# Email of the user that this resource quota applies to (optional)
|
25
|
+
user_email="test@anyscale.com",
|
26
|
+
# The quota limit for the number of CPUs (optional)
|
27
|
+
num_cpus=50,
|
28
|
+
# The quota limit for the number of instances (optional)
|
29
|
+
num_instances=100,
|
30
|
+
# The quota limit for the total number of GPUs (optional)
|
31
|
+
num_gpus=30,
|
32
|
+
# The quota limit for the number of accelerators (optional)
|
33
|
+
num_accelerators={"A100-80G": 10, "T4": 20},
|
34
|
+
)
|
35
|
+
"""
|
36
|
+
|
37
|
+
name: str = field(metadata={"docstring": "Name of the resource quota to create."})
|
38
|
+
|
39
|
+
def _validate_name(self, name: str):
|
40
|
+
if not isinstance(name, str):
|
41
|
+
raise TypeError("name must be a string.")
|
42
|
+
|
43
|
+
cloud: str = field(
|
44
|
+
metadata={"docstring": "Name of the cloud that this resource quota applies to."}
|
45
|
+
)
|
46
|
+
|
47
|
+
def _validate_cloud(self, cloud: str):
|
48
|
+
if not isinstance(cloud, str):
|
49
|
+
raise TypeError("cloud must be a string.")
|
50
|
+
|
51
|
+
project: Optional[str] = field(
|
52
|
+
default=None,
|
53
|
+
metadata={
|
54
|
+
"docstring": "Name of the project that this resource quota applies to (optional)."
|
55
|
+
},
|
56
|
+
)
|
57
|
+
|
58
|
+
def _validate_project(self, project: Optional[str]):
|
59
|
+
if project is not None and not isinstance(project, str):
|
60
|
+
raise TypeError("project must be a string.")
|
61
|
+
|
62
|
+
user_email: Optional[str] = field(
|
63
|
+
default=None,
|
64
|
+
metadata={
|
65
|
+
"docstring": "Email of the user that this resource quota applies to (optional)."
|
66
|
+
},
|
67
|
+
)
|
68
|
+
|
69
|
+
def _validate_user_email(self, user_email: Optional[str]):
|
70
|
+
if user_email is not None and not isinstance(user_email, str):
|
71
|
+
raise TypeError("user_email must be a string.")
|
72
|
+
|
73
|
+
num_cpus: Optional[int] = field(
|
74
|
+
default=None,
|
75
|
+
metadata={"docstring": "The quota limit for the number of CPUs (optional)."},
|
76
|
+
)
|
77
|
+
|
78
|
+
def _validate_num_cpus(self, num_cpus: Optional[int]):
|
79
|
+
if num_cpus is not None and not isinstance(num_cpus, int):
|
80
|
+
raise TypeError("num_cpus must be an integer.")
|
81
|
+
|
82
|
+
num_instances: Optional[int] = field(
|
83
|
+
default=None,
|
84
|
+
metadata={
|
85
|
+
"docstring": "The quota limit for the number of instances. (optional)."
|
86
|
+
},
|
87
|
+
)
|
88
|
+
|
89
|
+
def _validate_num_instances(self, num_instances: Optional[int]):
|
90
|
+
if num_instances is not None and not isinstance(num_instances, int):
|
91
|
+
raise TypeError("num_instances must be an integer.")
|
92
|
+
|
93
|
+
num_gpus: Optional[int] = field(
|
94
|
+
default=None,
|
95
|
+
metadata={
|
96
|
+
"docstring": "The quota limit for the total number of GPUs (optional)."
|
97
|
+
},
|
98
|
+
)
|
99
|
+
|
100
|
+
def _validate_num_gpus(self, num_gpus: Optional[int]):
|
101
|
+
if num_gpus is not None and not isinstance(num_gpus, int):
|
102
|
+
raise TypeError("num_gpus must be an integer.")
|
103
|
+
|
104
|
+
num_accelerators: Optional[Dict[str, int]] = field(
|
105
|
+
default=None,
|
106
|
+
metadata={
|
107
|
+
"docstring": "The quota limit for the number of accelerators (optional)."
|
108
|
+
},
|
109
|
+
)
|
110
|
+
|
111
|
+
def _validate_num_accelerators(self, num_accelerators: Optional[Dict[str, int]]):
|
112
|
+
if num_accelerators is not None and not isinstance(num_accelerators, dict):
|
113
|
+
raise TypeError("num_accelerators must be a dictionary.")
|
114
|
+
if num_accelerators is not None:
|
115
|
+
for key, value in num_accelerators.items():
|
116
|
+
if not isinstance(key, str):
|
117
|
+
raise TypeError("num_accelerators keys must be strings.")
|
118
|
+
if not isinstance(value, int):
|
119
|
+
raise TypeError("num_accelerators values must be integers.")
|
120
|
+
|
121
|
+
|
122
|
+
@dataclass(frozen=True)
|
123
|
+
class Quota(ModelBase):
|
124
|
+
"""Resource quota limit
|
125
|
+
"""
|
126
|
+
|
127
|
+
__doc_py_example__ = """\
|
128
|
+
import anyscale
|
129
|
+
from anyscale.resource_quota.models import CreateResourceQuota, ResourceQuota, Quota
|
130
|
+
|
131
|
+
create_resource_quota = CreateResourceQuota(
|
132
|
+
# Name of the resource quota to create
|
133
|
+
name="resource_quota_name",
|
134
|
+
# Name of the cloud that this resource quota applies to
|
135
|
+
cloud="cloud_name",
|
136
|
+
# Name of the project that this resource quota applies to (optional)
|
137
|
+
project="project_name",
|
138
|
+
# Email of the user that this resource quota applies to (optional)
|
139
|
+
user_email="test@anyscale.com",
|
140
|
+
# The quota limit for the number of CPUs (optional)
|
141
|
+
num_cpus=50,
|
142
|
+
# The quota limit for the number of instances (optional)
|
143
|
+
num_instances=100,
|
144
|
+
# The quota limit for the total number of GPUs (optional)
|
145
|
+
num_gpus=30,
|
146
|
+
# The quota limit for the number of accelerators (optional)
|
147
|
+
num_accelerators={"A100-80G": 10, "T4": 20},
|
148
|
+
)
|
149
|
+
|
150
|
+
resource_quota: ResourceQuota = anyscale.resource_quota.create(create_resource_quota)
|
151
|
+
|
152
|
+
quota: Quota = resource_quota.quota
|
153
|
+
"""
|
154
|
+
num_cpus: Optional[int] = field(
|
155
|
+
default=None,
|
156
|
+
metadata={"docstring": "The quota limit for the number of CPUs (optional)."},
|
157
|
+
)
|
158
|
+
|
159
|
+
def _validate_num_cpus(self, num_cpus: Optional[int]):
|
160
|
+
if num_cpus is not None and not isinstance(num_cpus, int):
|
161
|
+
raise TypeError("num_cpus must be an integer.")
|
162
|
+
|
163
|
+
num_instances: Optional[int] = field(
|
164
|
+
default=None,
|
165
|
+
metadata={
|
166
|
+
"docstring": "The quota limit for the number of instances. (optional)."
|
167
|
+
},
|
168
|
+
)
|
169
|
+
|
170
|
+
def _validate_num_instances(self, num_instances: Optional[int]):
|
171
|
+
if num_instances is not None and not isinstance(num_instances, int):
|
172
|
+
raise TypeError("num_instances must be an integer.")
|
173
|
+
|
174
|
+
num_gpus: Optional[int] = field(
|
175
|
+
default=None,
|
176
|
+
metadata={
|
177
|
+
"docstring": "The quota limit for the total number of GPUs (optional)."
|
178
|
+
},
|
179
|
+
)
|
180
|
+
|
181
|
+
def _validate_num_gpus(self, num_gpus: Optional[int]):
|
182
|
+
if num_gpus is not None and not isinstance(num_gpus, int):
|
183
|
+
raise TypeError("num_gpus must be an integer.")
|
184
|
+
|
185
|
+
num_accelerators: Optional[Dict[str, int]] = field(
|
186
|
+
default=None,
|
187
|
+
metadata={
|
188
|
+
"docstring": "The quota limit for the number of accelerators (optional)."
|
189
|
+
},
|
190
|
+
)
|
191
|
+
|
192
|
+
def _validate_num_accelerators(self, num_accelerators: Optional[Dict[str, int]]):
|
193
|
+
if num_accelerators is not None and not isinstance(num_accelerators, dict):
|
194
|
+
raise TypeError("num_accelerators must be a dictionary.")
|
195
|
+
if num_accelerators is not None:
|
196
|
+
for key, value in num_accelerators.items():
|
197
|
+
if not isinstance(key, str):
|
198
|
+
raise TypeError("num_accelerators keys must be strings.")
|
199
|
+
if not isinstance(value, int):
|
200
|
+
raise TypeError("num_accelerators values must be integers.")
|
201
|
+
|
202
|
+
|
203
|
+
@dataclass(frozen=True)
|
204
|
+
class ResourceQuota(ModelBase):
|
205
|
+
"""Resource quota
|
206
|
+
"""
|
207
|
+
|
208
|
+
__doc_py_example__ = """\
|
209
|
+
import anyscale
|
210
|
+
from anyscale.resource_quota.models import CreateResourceQuota, ResourceQuota
|
211
|
+
|
212
|
+
create_resource_quota = CreateResourceQuota(
|
213
|
+
# Name of the resource quota to create
|
214
|
+
name="resource_quota_name",
|
215
|
+
# Name of the cloud that this resource quota applies to
|
216
|
+
cloud="cloud_name",
|
217
|
+
# Name of the project that this resource quota applies to (optional)
|
218
|
+
project="project_name",
|
219
|
+
# Email of the user that this resource quota applies to (optional)
|
220
|
+
user_email="test@anyscale.com",
|
221
|
+
# The quota limit for the number of CPUs (optional)
|
222
|
+
num_cpus=50,
|
223
|
+
# The quota limit for the number of instances (optional)
|
224
|
+
num_instances=100,
|
225
|
+
# The quota limit for the total number of GPUs (optional)
|
226
|
+
num_gpus=30,
|
227
|
+
# The quota limit for the number of accelerators (optional)
|
228
|
+
num_accelerators={"A100-80G": 10, "T4": 20},
|
229
|
+
)
|
230
|
+
resource_quota: ResourceQuota = anyscale.resource_quota.create(create_resource_quota)
|
231
|
+
"""
|
232
|
+
id: str = field(metadata={"docstring": "The ID of the resource quota."})
|
233
|
+
|
234
|
+
def _validate_id(self, id: str): # noqa: A002
|
235
|
+
if not isinstance(id, str):
|
236
|
+
raise TypeError("id must be a string.")
|
237
|
+
|
238
|
+
name: str = field(metadata={"docstring": "Name of the resource quota."})
|
239
|
+
|
240
|
+
def _validate_name(self, name: str):
|
241
|
+
if not isinstance(name, str):
|
242
|
+
raise TypeError("name must be a string.")
|
243
|
+
|
244
|
+
quota: Quota = field(metadata={"docstring": "The quota limit."})
|
245
|
+
|
246
|
+
def _validate_quota(self, quota: Quota):
|
247
|
+
if not isinstance(quota, Quota):
|
248
|
+
raise TypeError("quota must be a Quota.")
|
249
|
+
|
250
|
+
created_at: datetime = field(
|
251
|
+
metadata={"docstring": "The timestamp when this resource quota was created."}
|
252
|
+
)
|
253
|
+
|
254
|
+
def _validate_created_at(self, created_at: datetime):
|
255
|
+
if not isinstance(created_at, datetime):
|
256
|
+
raise TypeError("created_at must be a datetime.")
|
257
|
+
|
258
|
+
cloud_id: str = field(
|
259
|
+
metadata={"docstring": "ID of the cloud that this resource quota applies to."}
|
260
|
+
)
|
261
|
+
|
262
|
+
def _validate_cloud_id(self, cloud_id: str):
|
263
|
+
if not isinstance(cloud_id, str):
|
264
|
+
raise TypeError("cloud_id must be a string.")
|
265
|
+
|
266
|
+
project_id: Optional[str] = field(
|
267
|
+
default=None,
|
268
|
+
metadata={
|
269
|
+
"docstring": "ID of the project that this resource quota applies to (optional)."
|
270
|
+
},
|
271
|
+
)
|
272
|
+
|
273
|
+
def _validate_project_id(self, project_id: Optional[str]):
|
274
|
+
if project_id is not None and not isinstance(project_id, str):
|
275
|
+
raise TypeError("project_id must be a string.")
|
276
|
+
|
277
|
+
user_id: Optional[str] = field(
|
278
|
+
default=None,
|
279
|
+
metadata={
|
280
|
+
"docstring": "ID of the user that this resource quota applies to (optional)."
|
281
|
+
},
|
282
|
+
)
|
283
|
+
|
284
|
+
def _validate_user_id(self, user_id: Optional[str]):
|
285
|
+
if user_id is not None and not isinstance(user_id, str):
|
286
|
+
raise TypeError("user_id must be a string.")
|
287
|
+
|
288
|
+
is_enabled: bool = field(
|
289
|
+
default=True, metadata={"docstring": "Whether the resource quota is enabled."}
|
290
|
+
)
|
291
|
+
|
292
|
+
def _validate_is_enabled(self, is_enabled: bool):
|
293
|
+
if not isinstance(is_enabled, bool):
|
294
|
+
raise TypeError("is_enabled must be a boolean.")
|
295
|
+
|
296
|
+
deleted_at: Optional[datetime] = field(
|
297
|
+
default=None,
|
298
|
+
metadata={"docstring": "The timestamp when this resource quota was deleted."},
|
299
|
+
)
|
300
|
+
|
301
|
+
def _validate_deleted_at(self, deleted_at: Optional[datetime]):
|
302
|
+
if deleted_at is not None and not isinstance(deleted_at, datetime):
|
303
|
+
raise TypeError("deleted_at must be a datetime.")
|
anyscale/scripts.py
CHANGED
@@ -29,6 +29,9 @@ from anyscale.commands.logs_commands import log_cli
|
|
29
29
|
from anyscale.commands.machine_commands import machine_cli
|
30
30
|
from anyscale.commands.machine_pool_commands import machine_pool_cli
|
31
31
|
from anyscale.commands.migrate_commands import migrate_cli
|
32
|
+
from anyscale.commands.organization_invitation_commands import (
|
33
|
+
organization_invitation_cli,
|
34
|
+
)
|
32
35
|
from anyscale.commands.project_commands import anyscale_init, project_cli
|
33
36
|
from anyscale.commands.resource_quota_commands import resource_quota_cli
|
34
37
|
from anyscale.commands.schedule_commands import schedule_cli
|
@@ -144,6 +147,7 @@ cli.add_command(service_account_cli)
|
|
144
147
|
cli.add_command(resource_quota_cli)
|
145
148
|
cli.add_command(aggregated_instance_usage_cli)
|
146
149
|
cli.add_command(user_cli)
|
150
|
+
cli.add_command(organization_invitation_cli)
|
147
151
|
|
148
152
|
ALIASES = {
|
149
153
|
"h": anyscale_help,
|
@@ -137,7 +137,6 @@ from anyscale_client.models.list_service_model import ListServiceModel
|
|
137
137
|
from anyscale_client.models.listservicemodel_list_response import ListservicemodelListResponse
|
138
138
|
from anyscale_client.models.log_download_result import LogDownloadResult
|
139
139
|
from anyscale_client.models.log_file_chunk import LogFileChunk
|
140
|
-
from anyscale_client.models.log_level_types import LogLevelTypes
|
141
140
|
from anyscale_client.models.log_stream import LogStream
|
142
141
|
from anyscale_client.models.logdownloadresult_response import LogdownloadresultResponse
|
143
142
|
from anyscale_client.models.logstream_response import LogstreamResponse
|
@@ -194,9 +193,6 @@ from anyscale_client.models.servicemodel_response import ServicemodelResponse
|
|
194
193
|
from anyscale_client.models.session import Session
|
195
194
|
from anyscale_client.models.session_command import SessionCommand
|
196
195
|
from anyscale_client.models.session_command_types import SessionCommandTypes
|
197
|
-
from anyscale_client.models.session_event import SessionEvent
|
198
|
-
from anyscale_client.models.session_event_cause import SessionEventCause
|
199
|
-
from anyscale_client.models.session_event_types import SessionEventTypes
|
200
196
|
from anyscale_client.models.session_list_response import SessionListResponse
|
201
197
|
from anyscale_client.models.session_operation import SessionOperation
|
202
198
|
from anyscale_client.models.session_operation_type import SessionOperationType
|
@@ -207,7 +203,6 @@ from anyscale_client.models.session_state_data import SessionStateData
|
|
207
203
|
from anyscale_client.models.session_stopping_data import SessionStoppingData
|
208
204
|
from anyscale_client.models.sessioncommand_list_response import SessioncommandListResponse
|
209
205
|
from anyscale_client.models.sessioncommand_response import SessioncommandResponse
|
210
|
-
from anyscale_client.models.sessionevent_list_response import SessioneventListResponse
|
211
206
|
from anyscale_client.models.sessionoperation_response import SessionoperationResponse
|
212
207
|
from anyscale_client.models.sessions_query import SessionsQuery
|
213
208
|
from anyscale_client.models.sort_by_clause_jobs_sort_field import SortByClauseJobsSortField
|