anyscale 0.24.87__py3-none-any.whl → 0.24.91__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 (120) hide show
  1. anyscale/__init__.py +56 -0
  2. anyscale/_private/anyscale_client/anyscale_client.py +158 -28
  3. anyscale/_private/anyscale_client/common.py +82 -0
  4. anyscale/_private/anyscale_client/fake_anyscale_client.py +193 -1
  5. anyscale/_private/docgen/README.md +1 -1
  6. anyscale/_private/docgen/__main__.py +74 -19
  7. anyscale/_private/docgen/api.md +0 -20
  8. anyscale/_private/docgen/generator.py +4 -2
  9. anyscale/_private/docgen/models.md +1 -46
  10. anyscale/_private/workload/workload_config.py +1 -1
  11. anyscale/aggregated_instance_usage/__init__.py +1 -1
  12. anyscale/aggregated_instance_usage/commands.py +2 -4
  13. anyscale/aggregated_instance_usage/models.py +8 -8
  14. anyscale/client/README.md +19 -23
  15. anyscale/client/openapi_client/__init__.py +13 -15
  16. anyscale/client/openapi_client/api/default_api.py +825 -962
  17. anyscale/client/openapi_client/models/__init__.py +13 -15
  18. anyscale/client/openapi_client/models/admin_create_user.py +255 -0
  19. anyscale/client/openapi_client/models/admin_created_user.py +281 -0
  20. anyscale/client/openapi_client/models/{sessionevent_list_response.py → admincreateduser_list_response.py} +15 -15
  21. anyscale/client/openapi_client/models/aggregated_usage_query.py +1 -29
  22. anyscale/client/openapi_client/models/{session_event_types.py → cloud_deployment_config.py} +35 -24
  23. anyscale/client/openapi_client/models/{platformfinetuningjob_response.py → clouddeploymentconfig_response.py} +11 -11
  24. anyscale/client/openapi_client/models/{company_size.py → cluster_size.py} +10 -10
  25. anyscale/client/openapi_client/models/cluster_status_details.py +2 -1
  26. anyscale/client/openapi_client/models/create_experimental_workspace.py +29 -1
  27. anyscale/client/openapi_client/models/{resubmit_ft_job_request.py → describe_machine_pool_request.py} +21 -20
  28. anyscale/client/openapi_client/models/describe_machine_pool_response.py +123 -0
  29. anyscale/client/openapi_client/models/{fine_tuning_job_status.py → describemachinepoolresponse_response.py} +34 -16
  30. anyscale/client/openapi_client/models/machine_allocation_state.py +3 -1
  31. anyscale/client/openapi_client/models/machine_state_info.py +326 -0
  32. anyscale/client/openapi_client/models/organization_marketing_questions.py +80 -54
  33. anyscale/client/openapi_client/models/request_state_info.py +210 -0
  34. anyscale/client/openapi_client/models/{platformfinetuningjob_list_response.py → scheduler_info.py} +43 -38
  35. anyscale/client/openapi_client/models/usage_by_cluster.py +28 -1
  36. anyscale/client/openapi_client/models/usage_by_user.py +30 -3
  37. anyscale/client/openapi_client/models/workload_info.py +210 -0
  38. anyscale/cloud/__init__.py +83 -0
  39. anyscale/cloud/_private/cloud_sdk.py +25 -0
  40. anyscale/cloud/commands.py +45 -0
  41. anyscale/cloud/models.py +91 -0
  42. anyscale/cluster_compute.py +1 -1
  43. anyscale/commands/aggregated_instance_usage_commands.py +4 -4
  44. anyscale/commands/cloud_commands.py +38 -2
  45. anyscale/commands/command_examples.py +67 -0
  46. anyscale/commands/job_commands.py +15 -3
  47. anyscale/commands/machine_pool_commands.py +113 -1
  48. anyscale/commands/organization_invitation_commands.py +98 -0
  49. anyscale/commands/project_commands.py +52 -2
  50. anyscale/commands/resource_quota_commands.py +98 -11
  51. anyscale/commands/service_commands.py +1 -1
  52. anyscale/commands/session_commands_hidden.py +5 -1
  53. anyscale/commands/user_commands.py +49 -0
  54. anyscale/commands/util.py +1 -1
  55. anyscale/commands/workspace_commands.py +1 -1
  56. anyscale/connect.py +1 -1
  57. anyscale/connect_utils/project.py +7 -4
  58. anyscale/controllers/cloud_controller.py +6 -6
  59. anyscale/controllers/cloud_functional_verification_controller.py +1 -1
  60. anyscale/controllers/cluster_controller.py +2 -2
  61. anyscale/controllers/compute_config_controller.py +1 -1
  62. anyscale/controllers/experimental_integrations_controller.py +1 -1
  63. anyscale/controllers/job_controller.py +8 -3
  64. anyscale/controllers/list_controller.py +2 -2
  65. anyscale/controllers/machine_pool_controller.py +12 -1
  66. anyscale/controllers/project_controller.py +4 -3
  67. anyscale/controllers/schedule_controller.py +1 -1
  68. anyscale/controllers/service_controller.py +1 -1
  69. anyscale/controllers/workspace_controller.py +1 -1
  70. anyscale/models/job_model.py +1 -1
  71. anyscale/organization_invitation/__init__.py +61 -0
  72. anyscale/organization_invitation/_private/organization_invitation_sdk.py +24 -0
  73. anyscale/organization_invitation/commands.py +84 -0
  74. anyscale/organization_invitation/models.py +45 -0
  75. anyscale/project/__init__.py +35 -0
  76. anyscale/project/_private/project_sdk.py +27 -0
  77. anyscale/project/commands.py +56 -0
  78. anyscale/project/models.py +91 -0
  79. anyscale/{project.py → project_utils.py} +3 -4
  80. anyscale/resource_quota/__init__.py +99 -0
  81. anyscale/resource_quota/_private/resource_quota_sdk.py +111 -0
  82. anyscale/resource_quota/commands.py +150 -0
  83. anyscale/resource_quota/models.py +303 -0
  84. anyscale/scripts.py +6 -0
  85. anyscale/sdk/anyscale_client/__init__.py +0 -5
  86. anyscale/sdk/anyscale_client/api/default_api.py +0 -150
  87. anyscale/sdk/anyscale_client/models/__init__.py +0 -5
  88. anyscale/sdk/anyscale_client/models/cluster_status_details.py +2 -1
  89. anyscale/sdk/anyscale_client/sdk.py +1 -1
  90. anyscale/user/__init__.py +35 -0
  91. anyscale/user/_private/user_sdk.py +32 -0
  92. anyscale/user/commands.py +42 -0
  93. anyscale/user/models.py +201 -0
  94. anyscale/util.py +15 -0
  95. anyscale/utils/cloud_utils.py +1 -1
  96. anyscale/version.py +1 -1
  97. anyscale/workspace_utils.py +1 -1
  98. {anyscale-0.24.87.dist-info → anyscale-0.24.91.dist-info}/METADATA +1 -5
  99. {anyscale-0.24.87.dist-info → anyscale-0.24.91.dist-info}/RECORD +105 -92
  100. anyscale/client/openapi_client/models/create_fine_tuning_hyperparameters.py +0 -156
  101. anyscale/client/openapi_client/models/create_fine_tuning_job_product_request.py +0 -353
  102. anyscale/client/openapi_client/models/finish_ft_job_request.py +0 -204
  103. anyscale/client/openapi_client/models/log_level_types.py +0 -100
  104. anyscale/client/openapi_client/models/paging_context.py +0 -172
  105. anyscale/client/openapi_client/models/platform_fine_tuning_job.py +0 -577
  106. anyscale/client/openapi_client/models/session_event.py +0 -267
  107. anyscale/client/openapi_client/models/session_event_cause.py +0 -150
  108. anyscale/controllers/resource_quota_controller.py +0 -183
  109. anyscale/sdk/anyscale_client/models/log_level_types.py +0 -100
  110. anyscale/sdk/anyscale_client/models/session_event.py +0 -267
  111. anyscale/sdk/anyscale_client/models/session_event_cause.py +0 -150
  112. anyscale/sdk/anyscale_client/models/session_event_types.py +0 -111
  113. anyscale/sdk/anyscale_client/models/sessionevent_list_response.py +0 -147
  114. anyscale/utils/imports/azure.py +0 -14
  115. /anyscale/{cloud.py → cloud_utils.py} +0 -0
  116. {anyscale-0.24.87.dist-info → anyscale-0.24.91.dist-info}/LICENSE +0 -0
  117. {anyscale-0.24.87.dist-info → anyscale-0.24.91.dist-info}/NOTICE +0 -0
  118. {anyscale-0.24.87.dist-info → anyscale-0.24.91.dist-info}/WHEEL +0 -0
  119. {anyscale-0.24.87.dist-info → anyscale-0.24.91.dist-info}/entry_points.txt +0 -0
  120. {anyscale-0.24.87.dist-info → anyscale-0.24.91.dist-info}/top_level.txt +0 -0
anyscale/__init__.py CHANGED
@@ -20,19 +20,25 @@ path.append(os.path.join(anyscale_dir, "sdk"))
20
20
  import anyscale
21
21
  from anyscale import (
22
22
  aggregated_instance_usage,
23
+ cloud,
23
24
  compute_config,
24
25
  image,
25
26
  integrations,
26
27
  job,
27
28
  llm,
29
+ organization_invitation,
30
+ project,
31
+ resource_quota,
28
32
  schedule,
29
33
  service,
34
+ user,
30
35
  )
31
36
  from anyscale._private.anyscale_client import AnyscaleClient, AnyscaleClientInterface
32
37
  from anyscale._private.sdk.base_sdk import Timer
33
38
  from anyscale.aggregated_instance_usage import AggregatedInstanceUsageSDK
34
39
  from anyscale.authenticate import AuthenticationBlock
35
40
  from anyscale.cli_logger import BlockLogger
41
+ from anyscale.cloud import CloudSDK
36
42
  from anyscale.cluster import get_job_submission_client_cluster_info
37
43
  from anyscale.cluster_compute import get_cluster_compute_from_name
38
44
  from anyscale.compute_config import ComputeConfigSDK
@@ -40,9 +46,13 @@ from anyscale.connect import ClientBuilder
40
46
  from anyscale.image import ImageSDK
41
47
  from anyscale.job import JobSDK
42
48
  from anyscale.llm import LLMSDK
49
+ from anyscale.organization_invitation import OrganizationInvitationSDK
50
+ from anyscale.project import ProjectSDK
51
+ from anyscale.resource_quota import ResourceQuotaSDK
43
52
  from anyscale.schedule import ScheduleSDK
44
53
  from anyscale.sdk.anyscale_client.sdk import AnyscaleSDK
45
54
  from anyscale.service import ServiceSDK
55
+ from anyscale.user import UserSDK
46
56
  from anyscale.workspace import WorkspaceSDK
47
57
 
48
58
 
@@ -56,6 +66,10 @@ for attr, _ in inspect.getmembers(ClientBuilder, inspect.isfunction):
56
66
  if attr.startswith("_"):
57
67
  continue
58
68
 
69
+ # This is exposed in anyscale/cloud/__init__.py since anyscale.cloud is used as the SDK module too.
70
+ if attr == "cloud":
71
+ continue
72
+
59
73
  def _new_builder(attr: str) -> Any:
60
74
  target = getattr(ClientBuilder, attr)
61
75
 
@@ -105,9 +119,16 @@ class Anyscale:
105
119
  self._job_sdk = JobSDK(client=self._anyscale_client)
106
120
  self._service_sdk = ServiceSDK(client=self._anyscale_client)
107
121
  self._compute_config_sdk = ComputeConfigSDK(client=self._anyscale_client)
122
+ self._cloud_sdk = CloudSDK(client=self._anyscale_client)
108
123
  self._schedule_sdk = ScheduleSDK(client=self._anyscale_client)
109
124
  self._image_sdk = ImageSDK(client=self._anyscale_client)
110
125
  self._llm_sdk = LLMSDK(client=self._anyscale_client)
126
+ self._organization_invitation_sdk = OrganizationInvitationSDK(
127
+ client=self._anyscale_client
128
+ )
129
+ self._project_sdk = ProjectSDK(client=self._anyscale_client)
130
+ self._resource_quota_sdk = ResourceQuotaSDK(client=self._anyscale_client)
131
+ self._user_sdk = UserSDK(client=self._anyscale_client)
111
132
  self._workspace_sdk = WorkspaceSDK(client=self._anyscale_client)
112
133
 
113
134
  @classmethod
@@ -128,10 +149,25 @@ class Anyscale:
128
149
  obj._compute_config_sdk = ComputeConfigSDK( # noqa: SLF001
129
150
  client=client, logger=logger, timer=timer
130
151
  )
152
+ obj._cloud_sdk = CloudSDK( # noqa: SLF001
153
+ client=client, logger=logger, timer=timer
154
+ )
131
155
  obj._schedule_sdk = ScheduleSDK( # noqa: SLF001
132
156
  client=client, logger=logger, timer=timer,
133
157
  )
134
158
  obj._image_sdk = ImageSDK(client=client, logger=logger) # noqa: SLF001
159
+ obj._organization_invitation_sdk = OrganizationInvitationSDK( # noqa: SLF001
160
+ client=client, logger=logger
161
+ )
162
+ obj._project_sdk = ProjectSDK( # noqa: SLF001
163
+ client=client, logger=logger, timer=timer
164
+ )
165
+ obj._user_sdk = UserSDK( # noqa: SLF001
166
+ client=client, logger=logger, timer=timer
167
+ )
168
+ obj._resource_quota_sdk = ResourceQuotaSDK( # noqa: SLF001
169
+ client=client, logger=logger, timer=timer
170
+ )
135
171
  obj._workspace_sdk = WorkspaceSDK( # noqa: SLF001
136
172
  client=client, logger=logger, timer=timer,
137
173
  )
@@ -153,6 +189,10 @@ class Anyscale:
153
189
  def compute_config(self) -> ComputeConfigSDK: # noqa: F811
154
190
  return self._compute_config_sdk
155
191
 
192
+ @property
193
+ def cloud(self) -> CloudSDK: # noqa: F811
194
+ return self._cloud_sdk
195
+
156
196
  @property
157
197
  def schedule(self) -> ScheduleSDK: # noqa: F811
158
198
  return self._schedule_sdk
@@ -165,6 +205,22 @@ class Anyscale:
165
205
  def llm(self) -> LLMSDK: # noqa: F811
166
206
  return self._llm_sdk
167
207
 
208
+ @property
209
+ def organization_invitation(self) -> OrganizationInvitationSDK: # noqa: F811
210
+ return self._organization_invitation_sdk
211
+
212
+ @property
213
+ def project(self) -> ProjectSDK: # noqa: F811
214
+ return self._project_sdk
215
+
216
+ @property
217
+ def resource_quota(self) -> ResourceQuotaSDK: # noqa: F811
218
+ return self._resource_quota_sdk
219
+
220
+ @property
221
+ def user(self) -> UserSDK: # noqa: F811
222
+ return self._user_sdk
223
+
168
224
  @property
169
225
  def workspace(self) -> WorkspaceSDK: # noqa: F811
170
226
  return self._workspace_sdk
@@ -34,6 +34,8 @@ from anyscale.authenticate import AuthenticationBlock, get_auth_api_client
34
34
  from anyscale.cli_logger import BlockLogger
35
35
  from anyscale.client.openapi_client.api.default_api import DefaultApi as InternalApi
36
36
  from anyscale.client.openapi_client.models import (
37
+ AdminCreatedUser,
38
+ AdminCreateUser,
37
39
  ArchiveStatus,
38
40
  Cloud,
39
41
  CloudDataBucketAccessMode,
@@ -45,10 +47,14 @@ from anyscale.client.openapi_client.models import (
45
47
  ComputeTemplate,
46
48
  ComputeTemplateConfig,
47
49
  ComputeTemplateQuery,
50
+ CreateCloudCollaborator,
48
51
  CreateComputeTemplate,
49
52
  CreateDataset,
50
53
  CreateExperimentalWorkspace,
51
54
  CreateInternalProductionJob,
55
+ CreateOrganizationInvitation,
56
+ CreateResourceQuota,
57
+ CreateUserProjectCollaborator,
52
58
  Dataset as InternalDataset,
53
59
  DatasetUpload,
54
60
  DecoratedComputeTemplate,
@@ -58,6 +64,11 @@ from anyscale.client.openapi_client.models import (
58
64
  FineTunedModel,
59
65
  FinetunedmodelListResponse,
60
66
  InternalProductionJob,
67
+ ListResourceQuotasQuery,
68
+ OrganizationCollaborator,
69
+ OrganizationInvitation,
70
+ ResourceQuota,
71
+ ResourceQuotaStatus,
61
72
  SessionSshKey,
62
73
  StartSessionOptions,
63
74
  StopSessionOptions,
@@ -542,6 +553,14 @@ class AnyscaleClient(AnyscaleClientInterface):
542
553
 
543
554
  raise e from None
544
555
 
556
+ @handle_api_exceptions
557
+ def add_cloud_collaborators(
558
+ self, cloud_id: str, collaborators: List[CreateCloudCollaborator]
559
+ ) -> None:
560
+ self._internal_api_client.batch_create_cloud_collaborators_api_v2_clouds_cloud_id_collaborators_users_batch_create_post(
561
+ cloud_id, collaborators
562
+ )
563
+
545
564
  @handle_api_exceptions
546
565
  def create_compute_config(
547
566
  self, config: ComputeTemplateConfig, *, name: Optional[str] = None
@@ -984,6 +1003,14 @@ class AnyscaleClient(AnyscaleClientInterface):
984
1003
  project_id
985
1004
  ).result
986
1005
 
1006
+ @handle_api_exceptions
1007
+ def add_project_collaborators(
1008
+ self, project_id: str, collaborators: List[CreateUserProjectCollaborator]
1009
+ ) -> None:
1010
+ self._internal_api_client.batch_create_project_collaborators_api_v2_projects_project_id_collaborators_users_batch_create_post(
1011
+ project_id, collaborators
1012
+ )
1013
+
987
1014
  @handle_api_exceptions
988
1015
  def get_job(
989
1016
  self,
@@ -1120,39 +1147,26 @@ class AnyscaleClient(AnyscaleClientInterface):
1120
1147
  # If the presigned URL scheme is SMART_OPEN, upload to cloud storage using the provided bucket name, path, & environment, and the smart_open library.
1121
1148
  bucket_name = info.bucket_name
1122
1149
  bucket_path = info.bucket_path
1123
- file_uri = info.file_uri
1124
-
1125
- if file_uri and file_uri.startswith("azure"):
1126
-
1127
- from anyscale.utils.imports.azure import (
1128
- try_import_azure_storage_blob_BlobServiceClient,
1129
- )
1130
-
1131
- # Smartopen needs transport_params to be passed in for Azure.
1132
- blob_service_client = (
1133
- try_import_azure_storage_blob_BlobServiceClient()
1134
- )
1135
1150
 
1136
- transport_params = {
1137
- "client": blob_service_client.from_connection_string(info.url),
1138
- }
1139
- with smart_open.open(
1140
- f"{file_uri}", "wb", transport_params=transport_params,
1141
- ) as fout:
1142
- fout.write(zip_file_bytes)
1143
- else:
1144
- env_vars: Dict[str, str] = {
1145
- "AWS_ENDPOINT_URL": info.url,
1146
- }
1147
- with set_env(**env_vars), smart_open.open(
1148
- f"{bucket_name}/{bucket_path}", "wb",
1149
- ) as fout:
1150
- fout.write(zip_file_bytes)
1151
+ env_vars: Dict[str, str] = {
1152
+ "AWS_ENDPOINT_URL": info.url,
1153
+ }
1154
+ with set_env(**env_vars), smart_open.open(
1155
+ f"{bucket_name}/{bucket_path}", "wb",
1156
+ ) as fout:
1157
+ fout.write(zip_file_bytes)
1151
1158
 
1152
1159
  else:
1153
1160
  # Default to HTTP PUT.
1154
1161
  internal_logger.debug(f"Uploading file '{file_name}' to cloud storage.")
1155
- requests.put(info.url, data=zip_file_bytes).raise_for_status()
1162
+ headers = (
1163
+ {"x-ms-blob-type": "BlockBlob"}
1164
+ if info.file_uri.startswith("azure")
1165
+ else None
1166
+ )
1167
+ requests.put(
1168
+ info.url, data=zip_file_bytes, headers=headers
1169
+ ).raise_for_status()
1156
1170
 
1157
1171
  return info.file_uri
1158
1172
 
@@ -1845,3 +1859,119 @@ class AnyscaleClient(AnyscaleClientInterface):
1845
1859
  )
1846
1860
 
1847
1861
  return filepath
1862
+
1863
+ @handle_api_exceptions
1864
+ def admin_batch_create_users(
1865
+ self, admin_create_users: List[AdminCreateUser]
1866
+ ) -> List[AdminCreatedUser]:
1867
+ return self._internal_api_client.admin_batch_create_users_api_v2_users_admin_batch_create_post(
1868
+ admin_create_users
1869
+ ).results
1870
+
1871
+ @handle_api_exceptions
1872
+ def create_organization_invitations(
1873
+ self, emails: List[str]
1874
+ ) -> Tuple[List[str], List[str]]:
1875
+ results = self._internal_api_client.batch_create_invitations_api_v2_organization_invitations_batch_create_post(
1876
+ [CreateOrganizationInvitation(email=email) for email in emails]
1877
+ ).results
1878
+
1879
+ success_emails = []
1880
+ error_messages = []
1881
+
1882
+ for idx, result in enumerate(results):
1883
+ if result.data:
1884
+ success_emails.append(emails[idx])
1885
+ else:
1886
+ error_messages.append(result.error.detail)
1887
+
1888
+ return success_emails, error_messages
1889
+
1890
+ @handle_api_exceptions
1891
+ def list_organization_invitations(self) -> List[OrganizationInvitation]:
1892
+ results = (
1893
+ self._internal_api_client.list_invitations_api_v2_organization_invitations_get().results
1894
+ )
1895
+
1896
+ return results
1897
+
1898
+ @handle_api_exceptions
1899
+ def delete_organization_invitation(self, email: str) -> OrganizationInvitation:
1900
+ invitation = self._internal_api_client.list_invitations_api_v2_organization_invitations_get(
1901
+ email=email
1902
+ ).results
1903
+
1904
+ if len(invitation) == 0:
1905
+ raise ValueError(f"Invitation for email '{email}' not found.")
1906
+ elif len(invitation) > 1:
1907
+ raise ValueError(
1908
+ f"Multiple invitations found for email '{email}'. Please contact Anyscale support."
1909
+ )
1910
+
1911
+ invitation_id = invitation[0].id
1912
+
1913
+ return self._internal_api_client.invalidate_invitation_api_v2_organization_invitations_invitation_id_invalidate_post(
1914
+ invitation_id
1915
+ ).result
1916
+
1917
+ @handle_api_exceptions
1918
+ def get_organization_collaborator(self, email: str) -> OrganizationCollaborator:
1919
+ results = self._internal_api_client.list_organization_collaborators_api_v2_organization_collaborators_get(
1920
+ email=email
1921
+ ).results
1922
+
1923
+ if len(results) == 0:
1924
+ raise ValueError(f"User with email '{email}' not found.")
1925
+
1926
+ if len(results) > 1:
1927
+ raise ValueError(
1928
+ f"Multiple users found for email '{email}'. Please contact Anyscale support."
1929
+ )
1930
+
1931
+ return results[0]
1932
+
1933
+ @handle_api_exceptions
1934
+ def create_resource_quota(
1935
+ self, create_resource_quota: CreateResourceQuota
1936
+ ) -> ResourceQuota:
1937
+ return self._internal_api_client.create_resource_quota_api_v2_resource_quotas_post(
1938
+ create_resource_quota
1939
+ ).result
1940
+
1941
+ @handle_api_exceptions
1942
+ def list_resource_quotas(
1943
+ self,
1944
+ name: Optional[str] = None,
1945
+ cloud_id: Optional[str] = None,
1946
+ creator_id: Optional[str] = None,
1947
+ is_enabled: Optional[bool] = None,
1948
+ max_items: int = 20,
1949
+ ) -> List[ResourceQuota]:
1950
+
1951
+ query = ListResourceQuotasQuery(
1952
+ name=TextQuery(equals=name) if name else None,
1953
+ cloud_id=cloud_id,
1954
+ creator_id=creator_id,
1955
+ is_enabled=is_enabled,
1956
+ paging=PageQuery(count=max_items),
1957
+ )
1958
+
1959
+ resource_quotas = self._internal_api_client.search_resource_quotas_api_v2_resource_quotas_search_post(
1960
+ query
1961
+ ).results
1962
+
1963
+ return resource_quotas
1964
+
1965
+ @handle_api_exceptions
1966
+ def delete_resource_quota(self, resource_quota_id: str) -> None:
1967
+ self._internal_api_client.delete_resource_quota_api_v2_resource_quotas_resource_quota_id_delete(
1968
+ resource_quota_id
1969
+ )
1970
+
1971
+ @handle_api_exceptions
1972
+ def set_resource_quota_status(
1973
+ self, resource_quota_id: str, is_enabled: bool
1974
+ ) -> None:
1975
+ self._internal_api_client.set_resource_quota_status_api_v2_resource_quotas_resource_quota_id_status_patch(
1976
+ resource_quota_id, ResourceQuotaStatus(is_enabled=is_enabled)
1977
+ ).result
@@ -4,15 +4,23 @@ from typing import Dict, Generator, List, Optional, Tuple
4
4
 
5
5
  from anyscale._private.models.image_uri import ImageURI
6
6
  from anyscale.client.openapi_client.models import (
7
+ AdminCreatedUser,
8
+ AdminCreateUser,
7
9
  Cloud,
8
10
  ComputeTemplateConfig,
11
+ CreateCloudCollaborator,
9
12
  CreateExperimentalWorkspace,
10
13
  CreateInternalProductionJob,
14
+ CreateResourceQuota,
15
+ CreateUserProjectCollaborator,
11
16
  DecoratedComputeTemplate,
12
17
  DeletedPlatformFineTunedModel,
13
18
  FineTunedModel,
14
19
  InternalProductionJob,
20
+ OrganizationCollaborator,
21
+ OrganizationInvitation,
15
22
  Project,
23
+ ResourceQuota,
16
24
  WorkspaceDataplaneProxiedArtifacts,
17
25
  )
18
26
  from anyscale.client.openapi_client.models.create_schedule import CreateSchedule
@@ -140,6 +148,13 @@ class AnyscaleClientInterface(ABC):
140
148
  """
141
149
  raise NotImplementedError
142
150
 
151
+ @abstractmethod
152
+ def add_cloud_collaborators(
153
+ self, cloud_id: str, collaborators: List[CreateCloudCollaborator]
154
+ ) -> None:
155
+ """Batch add collaborators to a cloud."""
156
+ raise NotImplementedError
157
+
143
158
  @abstractmethod
144
159
  def create_compute_config(
145
160
  self, config: ComputeTemplateConfig, *, name: Optional[str] = None
@@ -283,6 +298,13 @@ class AnyscaleClientInterface(ABC):
283
298
  """
284
299
  raise NotImplementedError
285
300
 
301
+ @abstractmethod
302
+ def add_project_collaborators(
303
+ self, project_id: str, collaborators: List[CreateUserProjectCollaborator]
304
+ ) -> None:
305
+ """Batch add collaborators to a project."""
306
+ raise NotImplementedError
307
+
286
308
  @abstractmethod
287
309
  def get_job(
288
310
  self,
@@ -591,3 +613,63 @@ class AnyscaleClientInterface(ABC):
591
613
  ) -> str:
592
614
  """Download the aggregated instance usage csv."""
593
615
  raise NotImplementedError
616
+
617
+ @abstractmethod
618
+ def admin_batch_create_users(
619
+ self, admin_create_users: List[AdminCreateUser]
620
+ ) -> List[AdminCreatedUser]:
621
+ """Batch create, as an admin, users without email verification."""
622
+ raise NotImplementedError
623
+
624
+ @abstractmethod
625
+ def create_organization_invitations(
626
+ self, emails: List[str]
627
+ ) -> Tuple[List[str], List[str]]:
628
+ """Create organization invitations."""
629
+ raise NotImplementedError
630
+
631
+ @abstractmethod
632
+ def list_organization_invitations(self) -> List[OrganizationInvitation]:
633
+ """List organization invitations."""
634
+ raise NotImplementedError
635
+
636
+ @abstractmethod
637
+ def delete_organization_invitation(self, email: str) -> OrganizationInvitation:
638
+ """Delete organization invitation."""
639
+ raise NotImplementedError
640
+
641
+ @abstractmethod
642
+ def get_organization_collaborator(self, email: str) -> OrganizationCollaborator:
643
+ """Get organization collaborator."""
644
+ raise NotImplementedError
645
+
646
+ @abstractmethod
647
+ def create_resource_quota(
648
+ self, create_resource_quota: CreateResourceQuota
649
+ ) -> ResourceQuota:
650
+ """Create a resource quota."""
651
+ raise NotImplementedError
652
+
653
+ @abstractmethod
654
+ def list_resource_quotas(
655
+ self,
656
+ name: Optional[str] = None,
657
+ cloud_id: Optional[str] = None,
658
+ creator_id: Optional[str] = None,
659
+ is_enabled: Optional[bool] = None,
660
+ max_items: int = 20,
661
+ ) -> List[ResourceQuota]:
662
+ """List resource quotas."""
663
+ raise NotImplementedError
664
+
665
+ @abstractmethod
666
+ def delete_resource_quota(self, resource_quota_id: str) -> None:
667
+ """Delete a resource quota."""
668
+ raise NotImplementedError
669
+
670
+ @abstractmethod
671
+ def set_resource_quota_status(
672
+ self, resource_quota_id: str, is_enabled: bool
673
+ ) -> None:
674
+ """Set the status of a resource quota."""
675
+ raise NotImplementedError