lightning-sdk 0.1.29__py3-none-any.whl → 0.1.31__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 (34) hide show
  1. lightning_sdk/__init__.py +1 -1
  2. lightning_sdk/api/teamspace_api.py +35 -5
  3. lightning_sdk/cli/download.py +19 -2
  4. lightning_sdk/cli/models.py +38 -0
  5. lightning_sdk/cli/upload.py +21 -2
  6. lightning_sdk/lightning_cloud/openapi/__init__.py +4 -0
  7. lightning_sdk/lightning_cloud/openapi/api/cloud_space_service_api.py +4 -4
  8. lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +5 -5
  9. lightning_sdk/lightning_cloud/openapi/api/deployment_templates_service_api.py +105 -0
  10. lightning_sdk/lightning_cloud/openapi/api/jobs_service_api.py +5 -1
  11. lightning_sdk/lightning_cloud/openapi/api/models_store_api.py +118 -2
  12. lightning_sdk/lightning_cloud/openapi/models/__init__.py +4 -0
  13. lightning_sdk/lightning_cloud/openapi/models/cluster_id_capacityblock_body.py +15 -15
  14. lightning_sdk/lightning_cloud/openapi/models/deployments_id_body.py +27 -1
  15. lightning_sdk/lightning_cloud/openapi/models/deploymenttemplates_id_body.py +43 -17
  16. lightning_sdk/lightning_cloud/openapi/models/id_engage_body.py +3 -29
  17. lightning_sdk/lightning_cloud/openapi/models/id_engage_body1.py +149 -0
  18. lightning_sdk/lightning_cloud/openapi/models/model_id_versions_body.py +123 -0
  19. lightning_sdk/lightning_cloud/openapi/models/project_id_models_body.py +27 -1
  20. lightning_sdk/lightning_cloud/openapi/models/v1_create_deployment_template_request.py +17 -17
  21. lightning_sdk/lightning_cloud/openapi/models/v1_deployment.py +27 -1
  22. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_template.py +17 -17
  23. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_template_engagement_response.py +97 -0
  24. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_template_parameter_placement.py +2 -0
  25. lightning_sdk/lightning_cloud/openapi/models/v1_model_version_archive.py +27 -1
  26. lightning_sdk/lightning_cloud/openapi/models/v1_parameterization_spec.py +227 -0
  27. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +27 -27
  28. lightning_sdk/teamspace.py +11 -0
  29. {lightning_sdk-0.1.29.dist-info → lightning_sdk-0.1.31.dist-info}/METADATA +1 -1
  30. {lightning_sdk-0.1.29.dist-info → lightning_sdk-0.1.31.dist-info}/RECORD +34 -29
  31. {lightning_sdk-0.1.29.dist-info → lightning_sdk-0.1.31.dist-info}/LICENSE +0 -0
  32. {lightning_sdk-0.1.29.dist-info → lightning_sdk-0.1.31.dist-info}/WHEEL +0 -0
  33. {lightning_sdk-0.1.29.dist-info → lightning_sdk-0.1.31.dist-info}/entry_points.txt +0 -0
  34. {lightning_sdk-0.1.29.dist-info → lightning_sdk-0.1.31.dist-info}/top_level.txt +0 -0
lightning_sdk/__init__.py CHANGED
@@ -25,5 +25,5 @@ __all__ = [
25
25
  "Agent",
26
26
  ]
27
27
 
28
- __version__ = "0.1.29"
28
+ __version__ = "0.1.31"
29
29
  _check_version_and_prompt_upgrade(__version__)
@@ -6,6 +6,7 @@ from typing import Dict, List, Optional
6
6
  from lightning_sdk.api.utils import _download_model_files, _DummyBody, _ModelFileUploader
7
7
  from lightning_sdk.lightning_cloud.login import Auth
8
8
  from lightning_sdk.lightning_cloud.openapi import (
9
+ ModelIdVersionsBody,
9
10
  ModelsStoreApi,
10
11
  ProjectIdAgentsBody,
11
12
  ProjectIdModelsBody,
@@ -28,6 +29,7 @@ class TeamspaceApi:
28
29
 
29
30
  def __init__(self) -> None:
30
31
  self._client = LightningClient(max_tries=7)
32
+ self._models: Optional[ModelsStoreApi] = None
31
33
 
32
34
  def get_teamspace(self, name: str, owner_id: str) -> V1Project:
33
35
  """Get the current teamspace from the owner."""
@@ -165,9 +167,36 @@ class TeamspaceApi:
165
167
  teamspace_id: str,
166
168
  cluster_id: str,
167
169
  ) -> V1ModelVersionArchive:
168
- api = ModelsStoreApi(self._client.api_client)
169
- body = ProjectIdModelsBody(cluster_id=cluster_id, metadata=metadata, name=name, private=private)
170
- return api.models_store_create_model(body, project_id=teamspace_id)
170
+ if not self._models:
171
+ self._models = ModelsStoreApi(self._client.api_client)
172
+ # ask if such model already exists by listing models with specific name
173
+ models = self._models.models_store_list_models(project_id=teamspace_id, name=name).models
174
+ if len(models) == 0:
175
+ return self._models.models_store_create_model(
176
+ body=ProjectIdModelsBody(cluster_id=cluster_id, metadata=metadata, name=name, private=private),
177
+ project_id=teamspace_id,
178
+ )
179
+ assert len(models) == 1, "Multiple models with the same name found"
180
+ return self._models.models_store_create_model_version(
181
+ body=ModelIdVersionsBody(cluster_id=cluster_id),
182
+ project_id=teamspace_id,
183
+ model_id=models[0].id,
184
+ )
185
+
186
+ def delete_model(self, name: str, version: Optional[str], teamspace_id: str) -> None:
187
+ """Delete a model or a version from the model store."""
188
+ if not self._models:
189
+ self._models = ModelsStoreApi(self._client.api_client)
190
+ models = self._models.models_store_list_models(project_id=teamspace_id, name=name).models
191
+ assert len(models) == 1, "Multiple models with the same name found"
192
+ model_id = models[0].id
193
+ # decide if delete only version of whole model
194
+ if version:
195
+ if version == "latest":
196
+ version = models[0].latest_version
197
+ self._models.models_store_delete_model_version(project_id=teamspace_id, model_id=model_id, version=version)
198
+ else:
199
+ self._models.models_store_delete_model(project_id=teamspace_id, model_id=model_id)
171
200
 
172
201
  def upload_model_file(
173
202
  self,
@@ -213,8 +242,9 @@ class TeamspaceApi:
213
242
  )
214
243
 
215
244
  def complete_model_upload(self, model_id: str, version: str, teamspace_id: str) -> None:
216
- api = ModelsStoreApi(self._client.api_client)
217
- api.models_store_complete_model_upload(
245
+ if not self._models:
246
+ self._models = ModelsStoreApi(self._client.api_client)
247
+ self._models.models_store_complete_model_upload(
218
248
  body=_DummyBody(),
219
249
  project_id=teamspace_id,
220
250
  model_id=model_id,
@@ -4,6 +4,7 @@ from pathlib import Path
4
4
  from typing import Optional
5
5
 
6
6
  from lightning_sdk.cli.exceptions import StudioCliError
7
+ from lightning_sdk.cli.models import _get_teamspace, _parse_model_name
7
8
  from lightning_sdk.cli.studios_menu import _StudiosMenu
8
9
  from lightning_sdk.studio import Studio
9
10
  from lightning_sdk.utils.resolve import _get_authed_user, skip_studio_init
@@ -12,6 +13,22 @@ from lightning_sdk.utils.resolve import _get_authed_user, skip_studio_init
12
13
  class _Downloads(_StudiosMenu):
13
14
  """Download files and folders from Lightning AI."""
14
15
 
16
+ def model(self, name: str, path: Optional[str] = None) -> None:
17
+ """Download a Model.
18
+
19
+ Args:
20
+ name: The name of the Model you want to download.
21
+ This should have the format <ORGANIZATION-NAME>/<TEAMSPACE-NAME>/<MODEL-NAME>.
22
+ path: The path to the directory where the Model should be downloaded.
23
+ """
24
+ org_name, teamspace_name, model_name = _parse_model_name(name)
25
+ teamspace = _get_teamspace(name=teamspace_name, organization=org_name)
26
+ teamspace.download_model(
27
+ name=model_name,
28
+ download_dir=path or ".",
29
+ progress_bar=True,
30
+ )
31
+
15
32
  def _resolve_studio(self, studio: Optional[str]) -> Studio:
16
33
  user = _get_authed_user()
17
34
  # if no studio specify suggest/filter only user's studios
@@ -53,7 +70,7 @@ class _Downloads(_StudiosMenu):
53
70
  return Studio(**selected_studio)
54
71
 
55
72
  def folder(self, path: str = "", studio: Optional[str] = None, local_path: str = ".") -> None:
56
- """Download a folder from a studio.
73
+ """Download a folder from a Studio.
57
74
 
58
75
  Args:
59
76
  path: The relative path within the Studio you want to download.
@@ -86,7 +103,7 @@ class _Downloads(_StudiosMenu):
86
103
  ) from e
87
104
 
88
105
  def file(self, path: str = "", studio: Optional[str] = None, local_path: str = ".") -> None:
89
- """Download a file from a studio.
106
+ """Download a file from a Studio.
90
107
 
91
108
  Args:
92
109
  path: The relative path within the Studio you want to download.
@@ -0,0 +1,38 @@
1
+ from typing import Tuple
2
+
3
+ from lightning_sdk.api import OrgApi, UserApi
4
+ from lightning_sdk.cli.exceptions import StudioCliError
5
+ from lightning_sdk.teamspace import Teamspace
6
+ from lightning_sdk.utils.resolve import _get_authed_user
7
+
8
+
9
+ def _parse_model_name(name: str) -> Tuple[str, str, str]:
10
+ """Parse the name argument into its components."""
11
+ try:
12
+ org_name, teamspace_name, model_name = name.split("/")
13
+ except ValueError as err:
14
+ raise StudioCliError(
15
+ f"Model name must be in the format 'organization/teamspace/model' but you provided '{name}'."
16
+ ) from err
17
+ return org_name, teamspace_name, model_name
18
+
19
+
20
+ def _get_teamspace(name: str, organization: str) -> Teamspace:
21
+ """Get a Teamspace object from the SDK."""
22
+ org_api = OrgApi()
23
+ user = _get_authed_user()
24
+ teamspaces = {}
25
+ for ts in UserApi()._get_all_teamspace_memberships(""):
26
+ if ts.owner_type == "organization":
27
+ org = org_api._get_org_by_id(ts.owner_id)
28
+ teamspaces[f"{org.name}/{ts.name}"] = {"name": ts.name, "org": org.name}
29
+ elif ts.owner_type == "user": # todo: check also the name
30
+ teamspaces[f"{user.name}/{ts.name}"] = {"name": ts.name, "user": user}
31
+ else:
32
+ raise StudioCliError(f"Unknown organization type {ts.owner_type}")
33
+
34
+ requested_teamspace = f"{organization}/{name}".lower()
35
+ if requested_teamspace not in teamspaces:
36
+ options = "\n\t".join(teamspaces.keys())
37
+ raise StudioCliError(f"Teamspace `{requested_teamspace}` not found. Available teamspaces: \n\t{options}")
38
+ return Teamspace(**teamspaces[requested_teamspace])
@@ -9,6 +9,7 @@ from tqdm import tqdm
9
9
 
10
10
  from lightning_sdk.api.utils import _get_cloud_url
11
11
  from lightning_sdk.cli.exceptions import StudioCliError
12
+ from lightning_sdk.cli.models import _get_teamspace, _parse_model_name
12
13
  from lightning_sdk.cli.studios_menu import _StudiosMenu
13
14
  from lightning_sdk.studio import Studio
14
15
  from lightning_sdk.utils.resolve import _get_authed_user, skip_studio_init
@@ -19,6 +20,24 @@ class _Uploads(_StudiosMenu):
19
20
 
20
21
  _studio_upload_status_path = "~/.lightning/studios/uploads"
21
22
 
23
+ def model(self, name: str, path: Optional[str] = None, cloud_account: Optional[str] = None) -> None:
24
+ """Upload a Model.
25
+
26
+ Args:
27
+ name: The name of the Model you want to upload.
28
+ This should have the format <ORGANIZATION-NAME>/<TEAMSPACE-NAME>/<MODEL-NAME>.
29
+ path: The path to the file or directory you want to upload. Defaults to the current directory.
30
+ cloud_account: The name of the cloud account to store the Model in.
31
+ """
32
+ org_name, teamspace_name, model_name = _parse_model_name(name)
33
+ teamspace = _get_teamspace(name=teamspace_name, organization=org_name)
34
+ teamspace.upload_model(
35
+ path=path or ".",
36
+ name=model_name,
37
+ progress_bar=True,
38
+ cluster_id=cloud_account,
39
+ )
40
+
22
41
  def _resolve_studio(self, studio: Optional[str]) -> Studio:
23
42
  user = _get_authed_user()
24
43
  possible_studios = self._get_possible_studios(user)
@@ -43,7 +62,7 @@ class _Uploads(_StudiosMenu):
43
62
  return Studio(**selected_studio)
44
63
 
45
64
  def folder(self, path: str, studio: Optional[str] = None, remote_path: Optional[str] = None) -> None:
46
- """Upload a file or folder to a studio.
65
+ """Upload a file or folder to a Studio.
47
66
 
48
67
  Args:
49
68
  path: The path to the file or directory you want to upload
@@ -97,7 +116,7 @@ class _Uploads(_StudiosMenu):
97
116
  print(f"See your files at {studio_url}")
98
117
 
99
118
  def file(self, path: str, studio: Optional[str] = None, remote_path: Optional[str] = None) -> None:
100
- """Upload a file to a studio.
119
+ """Upload a file to a Studio.
101
120
 
102
121
  Args:
103
122
  path: The path to the file you want to upload
@@ -104,6 +104,7 @@ from lightning_sdk.lightning_cloud.openapi.models.id_codeconfig_body import IdCo
104
104
  from lightning_sdk.lightning_cloud.openapi.models.id_collaborate_body import IdCollaborateBody
105
105
  from lightning_sdk.lightning_cloud.openapi.models.id_complete_body import IdCompleteBody
106
106
  from lightning_sdk.lightning_cloud.openapi.models.id_engage_body import IdEngageBody
107
+ from lightning_sdk.lightning_cloud.openapi.models.id_engage_body1 import IdEngageBody1
107
108
  from lightning_sdk.lightning_cloud.openapi.models.id_execute_body import IdExecuteBody
108
109
  from lightning_sdk.lightning_cloud.openapi.models.id_execute_body1 import IdExecuteBody1
109
110
  from lightning_sdk.lightning_cloud.openapi.models.id_fork_body import IdForkBody
@@ -133,6 +134,7 @@ from lightning_sdk.lightning_cloud.openapi.models.metrics_stream_id_loggerartifa
133
134
  from lightning_sdk.lightning_cloud.openapi.models.metricsstream_create_body import MetricsstreamCreateBody
134
135
  from lightning_sdk.lightning_cloud.openapi.models.metricsstream_delete_body import MetricsstreamDeleteBody
135
136
  from lightning_sdk.lightning_cloud.openapi.models.metricsstream_id_body import MetricsstreamIdBody
137
+ from lightning_sdk.lightning_cloud.openapi.models.model_id_versions_body import ModelIdVersionsBody
136
138
  from lightning_sdk.lightning_cloud.openapi.models.models_model_id_body import ModelsModelIdBody
137
139
  from lightning_sdk.lightning_cloud.openapi.models.multipartuploads_upload_id_body import MultipartuploadsUploadIdBody
138
140
  from lightning_sdk.lightning_cloud.openapi.models.org_id_memberships_body import OrgIdMembershipsBody
@@ -359,6 +361,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_state import V1D
359
361
  from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_status import V1DeploymentStatus
360
362
  from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_strategy import V1DeploymentStrategy
361
363
  from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_template import V1DeploymentTemplate
364
+ from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_template_engagement_response import V1DeploymentTemplateEngagementResponse
362
365
  from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_template_gallery_response import V1DeploymentTemplateGalleryResponse
363
366
  from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_template_parameter import V1DeploymentTemplateParameter
364
367
  from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_template_parameter_placement import V1DeploymentTemplateParameterPlacement
@@ -591,6 +594,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_org_role import V1OrgRole
591
594
  from lightning_sdk.lightning_cloud.openapi.models.v1_organization import V1Organization
592
595
  from lightning_sdk.lightning_cloud.openapi.models.v1_owner_type import V1OwnerType
593
596
  from lightning_sdk.lightning_cloud.openapi.models.v1_package_manager import V1PackageManager
597
+ from lightning_sdk.lightning_cloud.openapi.models.v1_parameterization_spec import V1ParameterizationSpec
594
598
  from lightning_sdk.lightning_cloud.openapi.models.v1_path_telemetry import V1PathTelemetry
595
599
  from lightning_sdk.lightning_cloud.openapi.models.v1_phase_type import V1PhaseType
596
600
  from lightning_sdk.lightning_cloud.openapi.models.v1_plugin import V1Plugin
@@ -1955,7 +1955,7 @@ class CloudSpaceServiceApi(object):
1955
1955
  _request_timeout=params.get('_request_timeout'),
1956
1956
  collection_formats=collection_formats)
1957
1957
 
1958
- def cloud_space_service_engage_cloud_space(self, body: 'IdEngageBody', project_id: 'str', id: 'str', **kwargs) -> 'V1CloudSpaceEngagementResponse': # noqa: E501
1958
+ def cloud_space_service_engage_cloud_space(self, body: 'IdEngageBody1', project_id: 'str', id: 'str', **kwargs) -> 'V1CloudSpaceEngagementResponse': # noqa: E501
1959
1959
  """cloud_space_service_engage_cloud_space # noqa: E501
1960
1960
 
1961
1961
  This method makes a synchronous HTTP request by default. To make an
@@ -1964,7 +1964,7 @@ class CloudSpaceServiceApi(object):
1964
1964
  >>> result = thread.get()
1965
1965
 
1966
1966
  :param async_req bool
1967
- :param IdEngageBody body: (required)
1967
+ :param IdEngageBody1 body: (required)
1968
1968
  :param str project_id: (required)
1969
1969
  :param str id: (required)
1970
1970
  :return: V1CloudSpaceEngagementResponse
@@ -1978,7 +1978,7 @@ class CloudSpaceServiceApi(object):
1978
1978
  (data) = self.cloud_space_service_engage_cloud_space_with_http_info(body, project_id, id, **kwargs) # noqa: E501
1979
1979
  return data
1980
1980
 
1981
- def cloud_space_service_engage_cloud_space_with_http_info(self, body: 'IdEngageBody', project_id: 'str', id: 'str', **kwargs) -> 'V1CloudSpaceEngagementResponse': # noqa: E501
1981
+ def cloud_space_service_engage_cloud_space_with_http_info(self, body: 'IdEngageBody1', project_id: 'str', id: 'str', **kwargs) -> 'V1CloudSpaceEngagementResponse': # noqa: E501
1982
1982
  """cloud_space_service_engage_cloud_space # noqa: E501
1983
1983
 
1984
1984
  This method makes a synchronous HTTP request by default. To make an
@@ -1987,7 +1987,7 @@ class CloudSpaceServiceApi(object):
1987
1987
  >>> result = thread.get()
1988
1988
 
1989
1989
  :param async_req bool
1990
- :param IdEngageBody body: (required)
1990
+ :param IdEngageBody1 body: (required)
1991
1991
  :param str project_id: (required)
1992
1992
  :param str id: (required)
1993
1993
  :return: V1CloudSpaceEngagementResponse
@@ -1106,10 +1106,10 @@ class ClusterServiceApi(object):
1106
1106
  :param str cluster_id: (required)
1107
1107
  :param str instance_type:
1108
1108
  :param int instance_count:
1109
- :param int capacity_block_duration_hours:
1110
1109
  :param datetime start_date:
1111
1110
  :param str timezone:
1112
1111
  :param str org_id:
1112
+ :param int capacity_block_duration_days:
1113
1113
  :return: V1FindCapacityBlockOfferingResponse
1114
1114
  If the method is called asynchronously,
1115
1115
  returns the request thread.
@@ -1134,16 +1134,16 @@ class ClusterServiceApi(object):
1134
1134
  :param str cluster_id: (required)
1135
1135
  :param str instance_type:
1136
1136
  :param int instance_count:
1137
- :param int capacity_block_duration_hours:
1138
1137
  :param datetime start_date:
1139
1138
  :param str timezone:
1140
1139
  :param str org_id:
1140
+ :param int capacity_block_duration_days:
1141
1141
  :return: V1FindCapacityBlockOfferingResponse
1142
1142
  If the method is called asynchronously,
1143
1143
  returns the request thread.
1144
1144
  """
1145
1145
 
1146
- all_params = ['project_id', 'cluster_id', 'instance_type', 'instance_count', 'capacity_block_duration_hours', 'start_date', 'timezone', 'org_id'] # noqa: E501
1146
+ all_params = ['project_id', 'cluster_id', 'instance_type', 'instance_count', 'start_date', 'timezone', 'org_id', 'capacity_block_duration_days'] # noqa: E501
1147
1147
  all_params.append('async_req')
1148
1148
  all_params.append('_return_http_data_only')
1149
1149
  all_params.append('_preload_content')
@@ -1180,14 +1180,14 @@ class ClusterServiceApi(object):
1180
1180
  query_params.append(('instanceType', params['instance_type'])) # noqa: E501
1181
1181
  if 'instance_count' in params:
1182
1182
  query_params.append(('instanceCount', params['instance_count'])) # noqa: E501
1183
- if 'capacity_block_duration_hours' in params:
1184
- query_params.append(('capacityBlockDurationHours', params['capacity_block_duration_hours'])) # noqa: E501
1185
1183
  if 'start_date' in params:
1186
1184
  query_params.append(('startDate', params['start_date'])) # noqa: E501
1187
1185
  if 'timezone' in params:
1188
1186
  query_params.append(('timezone', params['timezone'])) # noqa: E501
1189
1187
  if 'org_id' in params:
1190
1188
  query_params.append(('orgId', params['org_id'])) # noqa: E501
1189
+ if 'capacity_block_duration_days' in params:
1190
+ query_params.append(('capacityBlockDurationDays', params['capacity_block_duration_days'])) # noqa: E501
1191
1191
 
1192
1192
  header_params = {}
1193
1193
 
@@ -140,6 +140,111 @@ class DeploymentTemplatesServiceApi(object):
140
140
  _request_timeout=params.get('_request_timeout'),
141
141
  collection_formats=collection_formats)
142
142
 
143
+ def deployment_templates_service_engage_deployment_template(self, body: 'IdEngageBody', id: 'str', **kwargs) -> 'V1DeploymentTemplateEngagementResponse': # noqa: E501
144
+ """deployment_templates_service_engage_deployment_template # noqa: E501
145
+
146
+ This method makes a synchronous HTTP request by default. To make an
147
+ asynchronous HTTP request, please pass async_req=True
148
+ >>> thread = api.deployment_templates_service_engage_deployment_template(body, id, async_req=True)
149
+ >>> result = thread.get()
150
+
151
+ :param async_req bool
152
+ :param IdEngageBody body: (required)
153
+ :param str id: (required)
154
+ :return: V1DeploymentTemplateEngagementResponse
155
+ If the method is called asynchronously,
156
+ returns the request thread.
157
+ """
158
+ kwargs['_return_http_data_only'] = True
159
+ if kwargs.get('async_req'):
160
+ return self.deployment_templates_service_engage_deployment_template_with_http_info(body, id, **kwargs) # noqa: E501
161
+ else:
162
+ (data) = self.deployment_templates_service_engage_deployment_template_with_http_info(body, id, **kwargs) # noqa: E501
163
+ return data
164
+
165
+ def deployment_templates_service_engage_deployment_template_with_http_info(self, body: 'IdEngageBody', id: 'str', **kwargs) -> 'V1DeploymentTemplateEngagementResponse': # noqa: E501
166
+ """deployment_templates_service_engage_deployment_template # noqa: E501
167
+
168
+ This method makes a synchronous HTTP request by default. To make an
169
+ asynchronous HTTP request, please pass async_req=True
170
+ >>> thread = api.deployment_templates_service_engage_deployment_template_with_http_info(body, id, async_req=True)
171
+ >>> result = thread.get()
172
+
173
+ :param async_req bool
174
+ :param IdEngageBody body: (required)
175
+ :param str id: (required)
176
+ :return: V1DeploymentTemplateEngagementResponse
177
+ If the method is called asynchronously,
178
+ returns the request thread.
179
+ """
180
+
181
+ all_params = ['body', 'id'] # noqa: E501
182
+ all_params.append('async_req')
183
+ all_params.append('_return_http_data_only')
184
+ all_params.append('_preload_content')
185
+ all_params.append('_request_timeout')
186
+
187
+ params = locals()
188
+ for key, val in six.iteritems(params['kwargs']):
189
+ if key not in all_params:
190
+ raise TypeError(
191
+ "Got an unexpected keyword argument '%s'"
192
+ " to method deployment_templates_service_engage_deployment_template" % key
193
+ )
194
+ params[key] = val
195
+ del params['kwargs']
196
+ # verify the required parameter 'body' is set
197
+ if ('body' not in params or
198
+ params['body'] is None):
199
+ raise ValueError("Missing the required parameter `body` when calling `deployment_templates_service_engage_deployment_template`") # noqa: E501
200
+ # verify the required parameter 'id' is set
201
+ if ('id' not in params or
202
+ params['id'] is None):
203
+ raise ValueError("Missing the required parameter `id` when calling `deployment_templates_service_engage_deployment_template`") # noqa: E501
204
+
205
+ collection_formats = {}
206
+
207
+ path_params = {}
208
+ if 'id' in params:
209
+ path_params['id'] = params['id'] # noqa: E501
210
+
211
+ query_params = []
212
+
213
+ header_params = {}
214
+
215
+ form_params = []
216
+ local_var_files = {}
217
+
218
+ body_params = None
219
+ if 'body' in params:
220
+ body_params = params['body']
221
+ # HTTP header `Accept`
222
+ header_params['Accept'] = self.api_client.select_header_accept(
223
+ ['application/json']) # noqa: E501
224
+
225
+ # HTTP header `Content-Type`
226
+ header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
227
+ ['application/json']) # noqa: E501
228
+
229
+ # Authentication setting
230
+ auth_settings = [] # noqa: E501
231
+
232
+ return self.api_client.call_api(
233
+ '/v1/deployment-templates/{id}/engage', 'PUT',
234
+ path_params,
235
+ query_params,
236
+ header_params,
237
+ body=body_params,
238
+ post_params=form_params,
239
+ files=local_var_files,
240
+ response_type='V1DeploymentTemplateEngagementResponse', # noqa: E501
241
+ auth_settings=auth_settings,
242
+ async_req=params.get('async_req'),
243
+ _return_http_data_only=params.get('_return_http_data_only'),
244
+ _preload_content=params.get('_preload_content', True),
245
+ _request_timeout=params.get('_request_timeout'),
246
+ collection_formats=collection_formats)
247
+
143
248
  def deployment_templates_service_get_deployment_template(self, id: 'str', **kwargs) -> 'V1DeploymentTemplate': # noqa: E501
144
249
  """deployment_templates_service_get_deployment_template # noqa: E501
145
250
 
@@ -365,6 +365,7 @@ class JobsServiceApi(object):
365
365
  :param async_req bool
366
366
  :param str project_id: (required)
367
367
  :param str id: (required)
368
+ :param bool delete_templates:
368
369
  :return: V1DeleteDeploymentResponse
369
370
  If the method is called asynchronously,
370
371
  returns the request thread.
@@ -387,12 +388,13 @@ class JobsServiceApi(object):
387
388
  :param async_req bool
388
389
  :param str project_id: (required)
389
390
  :param str id: (required)
391
+ :param bool delete_templates:
390
392
  :return: V1DeleteDeploymentResponse
391
393
  If the method is called asynchronously,
392
394
  returns the request thread.
393
395
  """
394
396
 
395
- all_params = ['project_id', 'id'] # noqa: E501
397
+ all_params = ['project_id', 'id', 'delete_templates'] # noqa: E501
396
398
  all_params.append('async_req')
397
399
  all_params.append('_return_http_data_only')
398
400
  all_params.append('_preload_content')
@@ -425,6 +427,8 @@ class JobsServiceApi(object):
425
427
  path_params['id'] = params['id'] # noqa: E501
426
428
 
427
429
  query_params = []
430
+ if 'delete_templates' in params:
431
+ query_params.append(('deleteTemplates', params['delete_templates'])) # noqa: E501
428
432
 
429
433
  header_params = {}
430
434
 
@@ -28,7 +28,6 @@ import six
28
28
  from lightning_sdk.lightning_cloud.openapi.api_client import ApiClient
29
29
 
30
30
  if TYPE_CHECKING:
31
- from datetime import datetime
32
31
  from lightning_sdk.lightning_cloud.openapi.models import *
33
32
 
34
33
  class ModelsStoreApi(object):
@@ -398,6 +397,119 @@ class ModelsStoreApi(object):
398
397
  _request_timeout=params.get('_request_timeout'),
399
398
  collection_formats=collection_formats)
400
399
 
400
+ def models_store_create_model_version(self, body: 'ModelIdVersionsBody', project_id: 'str', model_id: 'str', **kwargs) -> 'V1ModelVersionArchive': # noqa: E501
401
+ """models_store_create_model_version # noqa: E501
402
+
403
+ This method makes a synchronous HTTP request by default. To make an
404
+ asynchronous HTTP request, please pass async_req=True
405
+ >>> thread = api.models_store_create_model_version(body, project_id, model_id, async_req=True)
406
+ >>> result = thread.get()
407
+
408
+ :param async_req bool
409
+ :param ModelIdVersionsBody body: (required)
410
+ :param str project_id: (required)
411
+ :param str model_id: (required)
412
+ :return: V1ModelVersionArchive
413
+ If the method is called asynchronously,
414
+ returns the request thread.
415
+ """
416
+ kwargs['_return_http_data_only'] = True
417
+ if kwargs.get('async_req'):
418
+ return self.models_store_create_model_version_with_http_info(body, project_id, model_id, **kwargs) # noqa: E501
419
+ else:
420
+ (data) = self.models_store_create_model_version_with_http_info(body, project_id, model_id, **kwargs) # noqa: E501
421
+ return data
422
+
423
+ def models_store_create_model_version_with_http_info(self, body: 'ModelIdVersionsBody', project_id: 'str', model_id: 'str', **kwargs) -> 'V1ModelVersionArchive': # noqa: E501
424
+ """models_store_create_model_version # noqa: E501
425
+
426
+ This method makes a synchronous HTTP request by default. To make an
427
+ asynchronous HTTP request, please pass async_req=True
428
+ >>> thread = api.models_store_create_model_version_with_http_info(body, project_id, model_id, async_req=True)
429
+ >>> result = thread.get()
430
+
431
+ :param async_req bool
432
+ :param ModelIdVersionsBody body: (required)
433
+ :param str project_id: (required)
434
+ :param str model_id: (required)
435
+ :return: V1ModelVersionArchive
436
+ If the method is called asynchronously,
437
+ returns the request thread.
438
+ """
439
+
440
+ all_params = ['body', 'project_id', 'model_id'] # noqa: E501
441
+ all_params.append('async_req')
442
+ all_params.append('_return_http_data_only')
443
+ all_params.append('_preload_content')
444
+ all_params.append('_request_timeout')
445
+
446
+ params = locals()
447
+ for key, val in six.iteritems(params['kwargs']):
448
+ if key not in all_params:
449
+ raise TypeError(
450
+ "Got an unexpected keyword argument '%s'"
451
+ " to method models_store_create_model_version" % key
452
+ )
453
+ params[key] = val
454
+ del params['kwargs']
455
+ # verify the required parameter 'body' is set
456
+ if ('body' not in params or
457
+ params['body'] is None):
458
+ raise ValueError("Missing the required parameter `body` when calling `models_store_create_model_version`") # noqa: E501
459
+ # verify the required parameter 'project_id' is set
460
+ if ('project_id' not in params or
461
+ params['project_id'] is None):
462
+ raise ValueError("Missing the required parameter `project_id` when calling `models_store_create_model_version`") # noqa: E501
463
+ # verify the required parameter 'model_id' is set
464
+ if ('model_id' not in params or
465
+ params['model_id'] is None):
466
+ raise ValueError("Missing the required parameter `model_id` when calling `models_store_create_model_version`") # noqa: E501
467
+
468
+ collection_formats = {}
469
+
470
+ path_params = {}
471
+ if 'project_id' in params:
472
+ path_params['projectId'] = params['project_id'] # noqa: E501
473
+ if 'model_id' in params:
474
+ path_params['modelId'] = params['model_id'] # noqa: E501
475
+
476
+ query_params = []
477
+
478
+ header_params = {}
479
+
480
+ form_params = []
481
+ local_var_files = {}
482
+
483
+ body_params = None
484
+ if 'body' in params:
485
+ body_params = params['body']
486
+ # HTTP header `Accept`
487
+ header_params['Accept'] = self.api_client.select_header_accept(
488
+ ['application/json']) # noqa: E501
489
+
490
+ # HTTP header `Content-Type`
491
+ header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
492
+ ['application/json']) # noqa: E501
493
+
494
+ # Authentication setting
495
+ auth_settings = [] # noqa: E501
496
+
497
+ return self.api_client.call_api(
498
+ '/v1/projects/{projectId}/models/{modelId}/versions', 'POST',
499
+ path_params,
500
+ query_params,
501
+ header_params,
502
+ body=body_params,
503
+ post_params=form_params,
504
+ files=local_var_files,
505
+ response_type='V1ModelVersionArchive', # noqa: E501
506
+ auth_settings=auth_settings,
507
+ async_req=params.get('async_req'),
508
+ _return_http_data_only=params.get('_return_http_data_only'),
509
+ _preload_content=params.get('_preload_content', True),
510
+ _request_timeout=params.get('_request_timeout'),
511
+ collection_formats=collection_formats)
512
+
401
513
  def models_store_create_multi_part_upload(self, body: 'VersionUploadsBody', project_id: 'str', model_id: 'str', version: 'str', **kwargs) -> 'V1CreateMultiPartUploadResponse': # noqa: E501
402
514
  """CreateMultiPartUpload initiates the multi-part upload of a file. Multiple requests can be sent to upload different files. # noqa: E501
403
515
 
@@ -1280,6 +1392,7 @@ class ModelsStoreApi(object):
1280
1392
 
1281
1393
  :param async_req bool
1282
1394
  :param str project_id: (required)
1395
+ :param str name:
1283
1396
  :return: V1ListModelsResponse
1284
1397
  If the method is called asynchronously,
1285
1398
  returns the request thread.
@@ -1301,12 +1414,13 @@ class ModelsStoreApi(object):
1301
1414
 
1302
1415
  :param async_req bool
1303
1416
  :param str project_id: (required)
1417
+ :param str name:
1304
1418
  :return: V1ListModelsResponse
1305
1419
  If the method is called asynchronously,
1306
1420
  returns the request thread.
1307
1421
  """
1308
1422
 
1309
- all_params = ['project_id'] # noqa: E501
1423
+ all_params = ['project_id', 'name'] # noqa: E501
1310
1424
  all_params.append('async_req')
1311
1425
  all_params.append('_return_http_data_only')
1312
1426
  all_params.append('_preload_content')
@@ -1333,6 +1447,8 @@ class ModelsStoreApi(object):
1333
1447
  path_params['projectId'] = params['project_id'] # noqa: E501
1334
1448
 
1335
1449
  query_params = []
1450
+ if 'name' in params:
1451
+ query_params.append(('name', params['name'])) # noqa: E501
1336
1452
 
1337
1453
  header_params = {}
1338
1454