lightning-sdk 0.1.51__py3-none-any.whl → 0.1.54__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.
- lightning_sdk/__init__.py +1 -1
- lightning_sdk/ai_hub.py +16 -27
- lightning_sdk/api/ai_hub_api.py +7 -1
- lightning_sdk/api/deployment_api.py +9 -1
- lightning_sdk/api/job_api.py +1 -1
- lightning_sdk/api/lit_container_api.py +2 -1
- lightning_sdk/cli/run.py +25 -20
- lightning_sdk/deployment/deployment.py +12 -3
- lightning_sdk/job/base.py +21 -0
- lightning_sdk/job/job.py +1 -12
- lightning_sdk/job/v1.py +1 -32
- lightning_sdk/job/v2.py +6 -1
- lightning_sdk/lightning_cloud/openapi/__init__.py +14 -0
- lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +105 -0
- lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +417 -1
- lightning_sdk/lightning_cloud/openapi/api/file_system_service_api.py +105 -0
- lightning_sdk/lightning_cloud/openapi/api/storage_service_api.py +101 -0
- lightning_sdk/lightning_cloud/openapi/api/user_service_api.py +5 -1
- lightning_sdk/lightning_cloud/openapi/models/__init__.py +14 -0
- lightning_sdk/lightning_cloud/openapi/models/cluster_id_usagerestrictions_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/id_contactowner_body.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/metricsstream_create_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/usagerestrictions_id_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_assistant_model_status.py +4 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_provider.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_artifact_event.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_artifact_event_type.py +103 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_accelerator.py +81 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_tagging_options.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_usage_restriction.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_contact_assistant_owner_reason.py +102 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_contact_assistant_owner_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_cluster_usage_restriction_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_deployment_api.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_filesystem_mmt.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_usage_restrictions_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_filesystem_mm_ts_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_metrics_stream.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_model.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_post_cloud_space_artifact_events_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_resource_visibility.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +53 -1
- lightning_sdk/lightning_cloud/utils/data_connection.py +75 -7
- lightning_sdk/mmt/mmt.py +8 -7
- lightning_sdk/plugin.py +5 -3
- lightning_sdk/studio.py +68 -1
- {lightning_sdk-0.1.51.dist-info → lightning_sdk-0.1.54.dist-info}/METADATA +1 -1
- {lightning_sdk-0.1.51.dist-info → lightning_sdk-0.1.54.dist-info}/RECORD +52 -38
- {lightning_sdk-0.1.51.dist-info → lightning_sdk-0.1.54.dist-info}/LICENSE +0 -0
- {lightning_sdk-0.1.51.dist-info → lightning_sdk-0.1.54.dist-info}/WHEEL +0 -0
- {lightning_sdk-0.1.51.dist-info → lightning_sdk-0.1.54.dist-info}/entry_points.txt +0 -0
- {lightning_sdk-0.1.51.dist-info → lightning_sdk-0.1.54.dist-info}/top_level.txt +0 -0
lightning_sdk/__init__.py
CHANGED
lightning_sdk/ai_hub.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
|
2
2
|
from urllib.parse import quote
|
|
3
3
|
|
|
4
|
-
from lightning_sdk.api import AIHubApi
|
|
5
|
-
from lightning_sdk.
|
|
6
|
-
from lightning_sdk.lightning_cloud.env import LIGHTNING_CLOUD_URL
|
|
4
|
+
from lightning_sdk.api import AIHubApi
|
|
5
|
+
from lightning_sdk.api.utils import _get_cloud_url
|
|
7
6
|
from lightning_sdk.user import User
|
|
8
|
-
from lightning_sdk.utils.resolve import
|
|
7
|
+
from lightning_sdk.utils.resolve import _resolve_teamspace
|
|
9
8
|
|
|
10
9
|
if TYPE_CHECKING:
|
|
11
10
|
from lightning_sdk import Organization, Teamspace
|
|
@@ -99,26 +98,6 @@ class AIHub:
|
|
|
99
98
|
results.append(result)
|
|
100
99
|
return results
|
|
101
100
|
|
|
102
|
-
def _authenticate(
|
|
103
|
-
self,
|
|
104
|
-
teamspace: Optional[Union[str, "Teamspace"]] = None,
|
|
105
|
-
org: Optional[Union[str, "Organization"]] = None,
|
|
106
|
-
user: Optional[Union[str, "User"]] = None,
|
|
107
|
-
) -> "Teamspace":
|
|
108
|
-
if self._auth is None:
|
|
109
|
-
self._auth = login.Auth()
|
|
110
|
-
try:
|
|
111
|
-
self._auth.authenticate()
|
|
112
|
-
user = User(name=UserApi()._get_user_by_id(self._auth.user_id).username)
|
|
113
|
-
except ConnectionError as e:
|
|
114
|
-
raise e
|
|
115
|
-
|
|
116
|
-
org = _resolve_org(org)
|
|
117
|
-
teamspace = _resolve_teamspace(teamspace=teamspace, org=org, user=user if org is None else None)
|
|
118
|
-
if teamspace is None:
|
|
119
|
-
raise ValueError("You need to pass a teamspace or an org for your deployment.")
|
|
120
|
-
return teamspace
|
|
121
|
-
|
|
122
101
|
def run(
|
|
123
102
|
self,
|
|
124
103
|
api_id: str,
|
|
@@ -127,6 +106,7 @@ class AIHub:
|
|
|
127
106
|
cloud_account: Optional[str] = None,
|
|
128
107
|
teamspace: Optional[Union[str, "Teamspace"]] = None,
|
|
129
108
|
org: Optional[Union[str, "Organization"]] = None,
|
|
109
|
+
user: Optional[Union[str, "User"]] = None,
|
|
130
110
|
) -> Dict[str, Union[str, bool]]:
|
|
131
111
|
"""Deploy an API from the AI Hub.
|
|
132
112
|
|
|
@@ -146,7 +126,8 @@ class AIHub:
|
|
|
146
126
|
cloud_account: The cloud account where you want to run the template, such as "lightning-public-prod".
|
|
147
127
|
Defaults to None.
|
|
148
128
|
teamspace: The team or group for deployment. Defaults to None.
|
|
149
|
-
org: The organization for deployment. Defaults to None.
|
|
129
|
+
org: The organization for deployment. Don't pass user with this. Defaults to None.
|
|
130
|
+
user: The user for deployment. Don't pass org with this. Defaults to None.
|
|
150
131
|
|
|
151
132
|
Returns:
|
|
152
133
|
A dictionary containing the name of the deployed API,
|
|
@@ -156,7 +137,13 @@ class AIHub:
|
|
|
156
137
|
ValueError: If a teamspace or organization is not provided.
|
|
157
138
|
ConnectionError: If there is an issue with logging in.
|
|
158
139
|
"""
|
|
159
|
-
|
|
140
|
+
if user is not None and org is not None:
|
|
141
|
+
raise ValueError("User and org are mutually exclusive. Please only specify the one owns the teamspace.")
|
|
142
|
+
|
|
143
|
+
teamspace = _resolve_teamspace(teamspace=teamspace, org=org, user=user)
|
|
144
|
+
if teamspace is None:
|
|
145
|
+
raise ValueError("You need to pass a teamspace or an org for your deployment.")
|
|
146
|
+
|
|
160
147
|
teamspace_id = teamspace.id
|
|
161
148
|
|
|
162
149
|
api_arguments = api_arguments or {}
|
|
@@ -167,13 +154,15 @@ class AIHub:
|
|
|
167
154
|
name=name,
|
|
168
155
|
api_arguments=api_arguments,
|
|
169
156
|
)
|
|
157
|
+
|
|
170
158
|
url = (
|
|
171
159
|
quote(
|
|
172
|
-
f"{
|
|
160
|
+
f"{_get_cloud_url}/{teamspace.owner.name}/{teamspace.name}/jobs/{deployment.name}",
|
|
173
161
|
safe=":/()",
|
|
174
162
|
)
|
|
175
163
|
+ "?app_id=deployment"
|
|
176
164
|
)
|
|
165
|
+
|
|
177
166
|
print("Deployment available at:", url)
|
|
178
167
|
|
|
179
168
|
return {
|
lightning_sdk/api/ai_hub_api.py
CHANGED
|
@@ -116,6 +116,12 @@ class AIHubApi:
|
|
|
116
116
|
name = name or template.name
|
|
117
117
|
template.spec_v2.endpoint.id = None
|
|
118
118
|
|
|
119
|
+
# These are needed to ensure templates with a max replicas of 0 will start on creation
|
|
120
|
+
if template.spec_v2.autoscaling.max_replicas == "0":
|
|
121
|
+
template.spec_v2.autoscaling.max_replicas = "1"
|
|
122
|
+
if not template.spec_v2.autoscaling.enabled:
|
|
123
|
+
template.spec_v2.autoscaling.enabled = True
|
|
124
|
+
|
|
119
125
|
AIHubApi._set_parameters(template.spec_v2.job, template.parameter_spec.parameters, api_arguments)
|
|
120
126
|
return self._client.jobs_service_create_deployment(
|
|
121
127
|
project_id=project_id,
|
|
@@ -124,7 +130,7 @@ class AIHubApi:
|
|
|
124
130
|
cluster_id=cloud_account,
|
|
125
131
|
endpoint=template.spec_v2.endpoint,
|
|
126
132
|
name=name,
|
|
127
|
-
replicas=
|
|
133
|
+
replicas=1,
|
|
128
134
|
spec=template.spec_v2.job,
|
|
129
135
|
),
|
|
130
136
|
)
|
|
@@ -213,6 +213,14 @@ class DeploymentApi:
|
|
|
213
213
|
return None
|
|
214
214
|
raise ex
|
|
215
215
|
|
|
216
|
+
def get_deployment_by_id(self, deployment_id: str, teamspace_id: str) -> Optional[V1Deployment]:
|
|
217
|
+
try:
|
|
218
|
+
return self._client.jobs_service_get_deployment(project_id=teamspace_id, id=deployment_id)
|
|
219
|
+
except ApiException as ex:
|
|
220
|
+
if "Reason: Not Found" in str(ex):
|
|
221
|
+
return None
|
|
222
|
+
raise ex
|
|
223
|
+
|
|
216
224
|
def create_deployment(
|
|
217
225
|
self,
|
|
218
226
|
deployment: V1Deployment,
|
|
@@ -269,7 +277,7 @@ class DeploymentApi:
|
|
|
269
277
|
requires_release |= apply_change(deployment.spec, "entrypoint", entrypoint)
|
|
270
278
|
requires_release |= apply_change(deployment.spec, "command", command)
|
|
271
279
|
requires_release |= apply_change(deployment.spec, "env", to_env(env))
|
|
272
|
-
requires_release |= apply_change(deployment.spec, "
|
|
280
|
+
requires_release |= apply_change(deployment.spec, "readiness_probe", to_health_check(health_check))
|
|
273
281
|
requires_release |= apply_change(deployment.spec, "cluster_id", cloud_account)
|
|
274
282
|
requires_release |= apply_change(deployment.spec, "spot", spot)
|
|
275
283
|
|
lightning_sdk/api/job_api.py
CHANGED
|
@@ -275,7 +275,7 @@ class JobApiV2:
|
|
|
275
275
|
return
|
|
276
276
|
|
|
277
277
|
if current_state != Status.Stopping:
|
|
278
|
-
update_body = JobsIdBody1(
|
|
278
|
+
update_body = JobsIdBody1(state=self.v2_job_state_stop)
|
|
279
279
|
self._client.jobs_service_update_job(body=update_body, project_id=teamspace_id, id=job_id)
|
|
280
280
|
|
|
281
281
|
while True:
|
|
@@ -48,7 +48,8 @@ class LitContainerApi:
|
|
|
48
48
|
raise ValueError(f"Container {container} does not exist") from None
|
|
49
49
|
|
|
50
50
|
registry_url = _get_registry_url()
|
|
51
|
-
|
|
51
|
+
container_basename = container.split("/")[-1]
|
|
52
|
+
repository = f"{registry_url}/lit-container/{teamspace.owner.name}/{teamspace.name}/{container_basename}"
|
|
52
53
|
tagged = self._docker_client.api.tag(container, repository, tag)
|
|
53
54
|
if not tagged:
|
|
54
55
|
raise ValueError(f"Could not tag container {container} with {repository}:{tag}")
|
lightning_sdk/cli/run.py
CHANGED
|
@@ -166,16 +166,7 @@ class _Run:
|
|
|
166
166
|
cloud_account = resolved_teamspace.default_cloud_account
|
|
167
167
|
machine_enum = Machine(machine.upper())
|
|
168
168
|
|
|
169
|
-
path_mappings_dict =
|
|
170
|
-
for mapping in path_mappings.split(","):
|
|
171
|
-
splits = str(mapping).split(":", 1)
|
|
172
|
-
if len(splits) != 2:
|
|
173
|
-
raise RuntimeError(
|
|
174
|
-
"Mapping needs to be of form <CONTAINER_PATH>:<CONNECTION_NAME>[:<PATH_WITHIN_CONNECTION>], "
|
|
175
|
-
f"but got {mapping}"
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
path_mappings_dict[splits[0]] = splits[1]
|
|
169
|
+
path_mappings_dict = self._resolve_path_mapping(path_mappings=path_mappings)
|
|
179
170
|
|
|
180
171
|
Job.run(
|
|
181
172
|
name=name,
|
|
@@ -242,16 +233,7 @@ class _Run:
|
|
|
242
233
|
if image is None:
|
|
243
234
|
raise RuntimeError("Image needs to be specified to run a multi-machine job")
|
|
244
235
|
|
|
245
|
-
path_mappings_dict =
|
|
246
|
-
for mapping in path_mappings.split(","):
|
|
247
|
-
splits = str(mapping).split(":", 1)
|
|
248
|
-
if len(splits) != 2:
|
|
249
|
-
raise RuntimeError(
|
|
250
|
-
"Mapping needs to be of form <CONTAINER_PATH>:<CONNECTION_NAME>[:<PATH_WITHIN_CONNECTION>], "
|
|
251
|
-
f"but got {mapping}"
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
path_mappings_dict[splits[0]] = splits[1]
|
|
236
|
+
path_mappings_dict = self._resolve_path_mapping(path_mappings=path_mappings)
|
|
255
237
|
|
|
256
238
|
MMT.run(
|
|
257
239
|
name=name,
|
|
@@ -273,3 +255,26 @@ class _Run:
|
|
|
273
255
|
artifacts_local=artifacts_local,
|
|
274
256
|
artifacts_remote=artifacts_remote,
|
|
275
257
|
)
|
|
258
|
+
|
|
259
|
+
@staticmethod
|
|
260
|
+
def _resolve_path_mapping(path_mappings: str) -> Dict[str, str]:
|
|
261
|
+
path_mappings = path_mappings.strip()
|
|
262
|
+
|
|
263
|
+
if not path_mappings:
|
|
264
|
+
return {}
|
|
265
|
+
|
|
266
|
+
path_mappings_dict = {}
|
|
267
|
+
for mapping in path_mappings.split(","):
|
|
268
|
+
if not mapping.strip():
|
|
269
|
+
continue
|
|
270
|
+
|
|
271
|
+
splits = str(mapping).split(":", 1)
|
|
272
|
+
if len(splits) != 2:
|
|
273
|
+
raise RuntimeError(
|
|
274
|
+
"Mapping needs to be of form <CONTAINER_PATH>:<CONNECTION_NAME>[:<PATH_WITHIN_CONNECTION>], "
|
|
275
|
+
f"but got {mapping}"
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
path_mappings_dict[splits[0].strip()] = splits[1].strip()
|
|
279
|
+
|
|
280
|
+
return path_mappings_dict
|
|
@@ -42,7 +42,7 @@ class Deployment:
|
|
|
42
42
|
and switching machine types, etc..
|
|
43
43
|
|
|
44
44
|
Args:
|
|
45
|
-
name: The name of the deployment.
|
|
45
|
+
name: The name or the id of the deployment.
|
|
46
46
|
teamspace: The teamspace in which you want to deploy.
|
|
47
47
|
org: The name of the organization owning the :param`teamspace` in case it is owned by an org
|
|
48
48
|
user: The name of the user owning the :param`teamspace` in case it is owned directly by a user instead of an org
|
|
@@ -55,7 +55,7 @@ class Deployment:
|
|
|
55
55
|
|
|
56
56
|
def __init__(
|
|
57
57
|
self,
|
|
58
|
-
name: str,
|
|
58
|
+
name: str,
|
|
59
59
|
teamspace: Optional[Union[str, Teamspace]] = None,
|
|
60
60
|
org: Optional[Union[str, Organization]] = None,
|
|
61
61
|
user: Optional[Union[str, User]] = None,
|
|
@@ -83,8 +83,14 @@ class Deployment:
|
|
|
83
83
|
self._deployment_api = DeploymentApi()
|
|
84
84
|
self._cloud_account = _get_cluster(client=self._deployment_api._client, project_id=self._teamspace.id)
|
|
85
85
|
self._is_created = False
|
|
86
|
-
|
|
86
|
+
|
|
87
|
+
if name.startswith("dep_"):
|
|
88
|
+
deployment = self._deployment_api.get_deployment_by_id(name, self._teamspace.id)
|
|
89
|
+
else:
|
|
90
|
+
deployment = self._deployment_api.get_deployment_by_name(name, self._teamspace.id)
|
|
91
|
+
|
|
87
92
|
if deployment:
|
|
93
|
+
self._name = deployment.name
|
|
88
94
|
self._is_created = True
|
|
89
95
|
self._deployment = deployment
|
|
90
96
|
|
|
@@ -163,6 +169,9 @@ class Deployment:
|
|
|
163
169
|
strategy=to_strategy(release_strategy),
|
|
164
170
|
)
|
|
165
171
|
)
|
|
172
|
+
|
|
173
|
+
# Overrides the name
|
|
174
|
+
self._name = self._deployment._name
|
|
166
175
|
self._is_created = True
|
|
167
176
|
|
|
168
177
|
def update(
|
lightning_sdk/job/base.py
CHANGED
|
@@ -275,6 +275,27 @@ class _BaseJob(ABC):
|
|
|
275
275
|
Caution: This also deletes all artifacts and snapshots associated with the job.
|
|
276
276
|
"""
|
|
277
277
|
|
|
278
|
+
def wait(self, interval: float = 5.0, timeout: Optional[float] = None) -> None:
|
|
279
|
+
"""Waits for the job to be either completed, manually stopped or failed.
|
|
280
|
+
|
|
281
|
+
Args:
|
|
282
|
+
interval: The number of seconds to spend in-between status checks.
|
|
283
|
+
timeout: The maximum number of seconds to wait before raising an error. If None, waits forever.
|
|
284
|
+
"""
|
|
285
|
+
import time
|
|
286
|
+
|
|
287
|
+
from lightning_sdk.status import Status
|
|
288
|
+
|
|
289
|
+
start = time.time()
|
|
290
|
+
while True:
|
|
291
|
+
if self.status in (Status.Completed, Status.Stopped, Status.Failed):
|
|
292
|
+
break
|
|
293
|
+
|
|
294
|
+
if timeout is not None and time.time() - start > timeout:
|
|
295
|
+
raise TimeoutError("Job didn't finish within the provided timeout.")
|
|
296
|
+
|
|
297
|
+
time.sleep(interval)
|
|
298
|
+
|
|
278
299
|
@property
|
|
279
300
|
@abstractmethod
|
|
280
301
|
def status(self) -> "Status":
|
lightning_sdk/job/job.py
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
from functools import lru_cache
|
|
2
1
|
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
|
|
3
2
|
|
|
4
|
-
from lightning_sdk.api.user_api import UserApi
|
|
5
3
|
from lightning_sdk.job.base import _BaseJob
|
|
6
4
|
from lightning_sdk.job.v1 import _JobV1
|
|
7
5
|
from lightning_sdk.job.v2 import _JobV2
|
|
@@ -18,15 +16,6 @@ if TYPE_CHECKING:
|
|
|
18
16
|
from lightning_sdk.user import User
|
|
19
17
|
|
|
20
18
|
|
|
21
|
-
@lru_cache(maxsize=None)
|
|
22
|
-
def _has_jobs_v2() -> bool:
|
|
23
|
-
api = UserApi()
|
|
24
|
-
try:
|
|
25
|
-
return api._get_feature_flags().jobs_v2
|
|
26
|
-
except Exception:
|
|
27
|
-
return False
|
|
28
|
-
|
|
29
|
-
|
|
30
19
|
class Job(_BaseJob):
|
|
31
20
|
"""Class to submit and manage single-machine jobs on the Lightning AI Platform."""
|
|
32
21
|
|
|
@@ -52,7 +41,7 @@ class Job(_BaseJob):
|
|
|
52
41
|
"""
|
|
53
42
|
from lightning_sdk.lightning_cloud.openapi.rest import ApiException
|
|
54
43
|
|
|
55
|
-
if
|
|
44
|
+
if not self._force_v1:
|
|
56
45
|
# try with v2 and fall back to v1
|
|
57
46
|
try:
|
|
58
47
|
job = _JobV2(
|
lightning_sdk/job/v1.py
CHANGED
|
@@ -126,38 +126,7 @@ class _JobV1(_BaseJob):
|
|
|
126
126
|
The submitted job.
|
|
127
127
|
|
|
128
128
|
"""
|
|
129
|
-
|
|
130
|
-
raise ValueError("Studio is required for submitting jobs")
|
|
131
|
-
if image is not None or image_credentials is not None or cloud_account_auth:
|
|
132
|
-
raise ValueError("Image is not supported for submitting jobs")
|
|
133
|
-
|
|
134
|
-
if artifacts_local is not None or artifacts_remote is not None:
|
|
135
|
-
raise ValueError("Specifying how to persist artifacts is not yet supported with jobs")
|
|
136
|
-
|
|
137
|
-
if env is not None:
|
|
138
|
-
raise ValueError("Environment variables are not supported for submitting jobs")
|
|
139
|
-
if command is None:
|
|
140
|
-
raise ValueError("Command is required for submitting jobs")
|
|
141
|
-
|
|
142
|
-
if entrypoint != "sh -c":
|
|
143
|
-
raise ValueError("Specifying the entrypoint is not yet supported with jobs")
|
|
144
|
-
|
|
145
|
-
if path_mappings is not None:
|
|
146
|
-
raise ValueError("Specifying path mappings is not yet supported with jobs")
|
|
147
|
-
|
|
148
|
-
# TODO: add support for empty names (will give an empty string)
|
|
149
|
-
_submitted = self._job_api.submit_job(
|
|
150
|
-
name=self._name,
|
|
151
|
-
command=command,
|
|
152
|
-
studio_id=studio._studio.id,
|
|
153
|
-
teamspace_id=self._teamspace.id,
|
|
154
|
-
cloud_account=cloud_account or "",
|
|
155
|
-
machine=machine,
|
|
156
|
-
interruptible=interruptible,
|
|
157
|
-
)
|
|
158
|
-
self._name = _submitted.name
|
|
159
|
-
self._job = _submitted
|
|
160
|
-
return self
|
|
129
|
+
raise NotImplementedError("Cannot submit new jobs with JobsV1!")
|
|
161
130
|
|
|
162
131
|
def _update_internal_job(self) -> None:
|
|
163
132
|
try:
|
lightning_sdk/job/v2.py
CHANGED
|
@@ -140,7 +140,12 @@ class _JobV2(_BaseJob):
|
|
|
140
140
|
@property
|
|
141
141
|
def status(self) -> "Status":
|
|
142
142
|
"""The current status of the job."""
|
|
143
|
-
|
|
143
|
+
try:
|
|
144
|
+
return self._job_api._job_state_to_external(self._latest_job.state)
|
|
145
|
+
except Exception:
|
|
146
|
+
raise RuntimeError(
|
|
147
|
+
f"Job {self._name} does not exist in Teamspace {self.teamspace.name}. Did you delete it?"
|
|
148
|
+
) from None
|
|
144
149
|
|
|
145
150
|
@property
|
|
146
151
|
def machine(self) -> Union["Machine", str]:
|
|
@@ -80,6 +80,7 @@ from lightning_sdk.lightning_cloud.openapi.models.cloudspaces_id_body import Clo
|
|
|
80
80
|
from lightning_sdk.lightning_cloud.openapi.models.cluster_id_capacityblock_body import ClusterIdCapacityblockBody
|
|
81
81
|
from lightning_sdk.lightning_cloud.openapi.models.cluster_id_capacityreservations_body import ClusterIdCapacityreservationsBody
|
|
82
82
|
from lightning_sdk.lightning_cloud.openapi.models.cluster_id_proxies_body import ClusterIdProxiesBody
|
|
83
|
+
from lightning_sdk.lightning_cloud.openapi.models.cluster_id_usagerestrictions_body import ClusterIdUsagerestrictionsBody
|
|
83
84
|
from lightning_sdk.lightning_cloud.openapi.models.clusters_id_body import ClustersIdBody
|
|
84
85
|
from lightning_sdk.lightning_cloud.openapi.models.clusters_id_body1 import ClustersIdBody1
|
|
85
86
|
from lightning_sdk.lightning_cloud.openapi.models.command_argument_command_argument_type import CommandArgumentCommandArgumentType
|
|
@@ -105,6 +106,7 @@ from lightning_sdk.lightning_cloud.openapi.models.id_artifacts_body import IdArt
|
|
|
105
106
|
from lightning_sdk.lightning_cloud.openapi.models.id_codeconfig_body import IdCodeconfigBody
|
|
106
107
|
from lightning_sdk.lightning_cloud.openapi.models.id_collaborate_body import IdCollaborateBody
|
|
107
108
|
from lightning_sdk.lightning_cloud.openapi.models.id_complete_body import IdCompleteBody
|
|
109
|
+
from lightning_sdk.lightning_cloud.openapi.models.id_contactowner_body import IdContactownerBody
|
|
108
110
|
from lightning_sdk.lightning_cloud.openapi.models.id_engage_body import IdEngageBody
|
|
109
111
|
from lightning_sdk.lightning_cloud.openapi.models.id_engage_body1 import IdEngageBody1
|
|
110
112
|
from lightning_sdk.lightning_cloud.openapi.models.id_execute_body import IdExecuteBody
|
|
@@ -191,6 +193,7 @@ from lightning_sdk.lightning_cloud.openapi.models.update import Update
|
|
|
191
193
|
from lightning_sdk.lightning_cloud.openapi.models.upload_id_complete_body import UploadIdCompleteBody
|
|
192
194
|
from lightning_sdk.lightning_cloud.openapi.models.upload_id_parts_body import UploadIdPartsBody
|
|
193
195
|
from lightning_sdk.lightning_cloud.openapi.models.uploads_upload_id_body import UploadsUploadIdBody
|
|
196
|
+
from lightning_sdk.lightning_cloud.openapi.models.usagerestrictions_id_body import UsagerestrictionsIdBody
|
|
194
197
|
from lightning_sdk.lightning_cloud.openapi.models.user_id_affiliatelinks_body import UserIdAffiliatelinksBody
|
|
195
198
|
from lightning_sdk.lightning_cloud.openapi.models.user_id_membershiprolebindings_body import UserIdMembershiprolebindingsBody
|
|
196
199
|
from lightning_sdk.lightning_cloud.openapi.models.user_id_membershiprolebindings_body1 import UserIdMembershiprolebindingsBody1
|
|
@@ -235,11 +238,14 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_capacity_block_offering imp
|
|
|
235
238
|
from lightning_sdk.lightning_cloud.openapi.models.v1_check_external_service_status_response import V1CheckExternalServiceStatusResponse
|
|
236
239
|
from lightning_sdk.lightning_cloud.openapi.models.v1_check_snowflake_connection_response import V1CheckSnowflakeConnectionResponse
|
|
237
240
|
from lightning_sdk.lightning_cloud.openapi.models.v1_checkbox import V1Checkbox
|
|
241
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_provider import V1CloudProvider
|
|
238
242
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space import V1CloudSpace
|
|
239
243
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_app import V1CloudSpaceApp
|
|
240
244
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_app_action import V1CloudSpaceAppAction
|
|
241
245
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_app_action_type import V1CloudSpaceAppActionType
|
|
242
246
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_app_owner_type import V1CloudSpaceAppOwnerType
|
|
247
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_artifact_event import V1CloudSpaceArtifactEvent
|
|
248
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_artifact_event_type import V1CloudSpaceArtifactEventType
|
|
243
249
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_code_version import V1CloudSpaceCodeVersion
|
|
244
250
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_code_version_status import V1CloudSpaceCodeVersionStatus
|
|
245
251
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_engagement_response import V1CloudSpaceEngagementResponse
|
|
@@ -269,6 +275,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_state import V1Clus
|
|
|
269
275
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_status import V1ClusterStatus
|
|
270
276
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_tagging_options import V1ClusterTaggingOptions
|
|
271
277
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_type import V1ClusterType
|
|
278
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_usage_restriction import V1ClusterUsageRestriction
|
|
272
279
|
from lightning_sdk.lightning_cloud.openapi.models.v1_collab_action import V1CollabAction
|
|
273
280
|
from lightning_sdk.lightning_cloud.openapi.models.v1_collab_session import V1CollabSession
|
|
274
281
|
from lightning_sdk.lightning_cloud.openapi.models.v1_command_argument import V1CommandArgument
|
|
@@ -281,6 +288,8 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_complete_upload_project_art
|
|
|
281
288
|
from lightning_sdk.lightning_cloud.openapi.models.v1_complete_upload_service_execution_artifact_response import V1CompleteUploadServiceExecutionArtifactResponse
|
|
282
289
|
from lightning_sdk.lightning_cloud.openapi.models.v1_completed_part import V1CompletedPart
|
|
283
290
|
from lightning_sdk.lightning_cloud.openapi.models.v1_compute_config import V1ComputeConfig
|
|
291
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_contact_assistant_owner_reason import V1ContactAssistantOwnerReason
|
|
292
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_contact_assistant_owner_response import V1ContactAssistantOwnerResponse
|
|
284
293
|
from lightning_sdk.lightning_cloud.openapi.models.v1_conversation import V1Conversation
|
|
285
294
|
from lightning_sdk.lightning_cloud.openapi.models.v1_conversation_response_chunk import V1ConversationResponseChunk
|
|
286
295
|
from lightning_sdk.lightning_cloud.openapi.models.v1_count_metrics_streams_response import V1CountMetricsStreamsResponse
|
|
@@ -328,6 +337,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_capacity_res
|
|
|
328
337
|
from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_encryption_key_response import V1DeleteClusterEncryptionKeyResponse
|
|
329
338
|
from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_proxy_response import V1DeleteClusterProxyResponse
|
|
330
339
|
from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_response import V1DeleteClusterResponse
|
|
340
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_usage_restriction_response import V1DeleteClusterUsageRestrictionResponse
|
|
331
341
|
from lightning_sdk.lightning_cloud.openapi.models.v1_delete_conversation_response import V1DeleteConversationResponse
|
|
332
342
|
from lightning_sdk.lightning_cloud.openapi.models.v1_delete_data_connection_response import V1DeleteDataConnectionResponse
|
|
333
343
|
from lightning_sdk.lightning_cloud.openapi.models.v1_delete_dataset_response import V1DeleteDatasetResponse
|
|
@@ -417,6 +427,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_app import V1Fil
|
|
|
417
427
|
from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_cloud_space import V1FilesystemCloudSpace
|
|
418
428
|
from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_dataset import V1FilesystemDataset
|
|
419
429
|
from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_job import V1FilesystemJob
|
|
430
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_mmt import V1FilesystemMMT
|
|
420
431
|
from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_slurm_job import V1FilesystemSlurmJob
|
|
421
432
|
from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_snowflake_connection import V1FilesystemSnowflakeConnection
|
|
422
433
|
from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_work import V1FilesystemWork
|
|
@@ -526,6 +537,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_list_cluster_accelerators_r
|
|
|
526
537
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cluster_availabilities_response import V1ListClusterAvailabilitiesResponse
|
|
527
538
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cluster_capacity_reservations_response import V1ListClusterCapacityReservationsResponse
|
|
528
539
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cluster_proxies_response import V1ListClusterProxiesResponse
|
|
540
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cluster_usage_restrictions_response import V1ListClusterUsageRestrictionsResponse
|
|
529
541
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_clusters_response import V1ListClustersResponse
|
|
530
542
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_conversations_response import V1ListConversationsResponse
|
|
531
543
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_data_connection_artifacts_response import V1ListDataConnectionArtifactsResponse
|
|
@@ -544,6 +556,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_list_filesystem_apps_respon
|
|
|
544
556
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_filesystem_cloud_spaces_response import V1ListFilesystemCloudSpacesResponse
|
|
545
557
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_filesystem_datasets_response import V1ListFilesystemDatasetsResponse
|
|
546
558
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_filesystem_jobs_response import V1ListFilesystemJobsResponse
|
|
559
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_list_filesystem_mm_ts_response import V1ListFilesystemMMTsResponse
|
|
547
560
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_filesystem_slurm_jobs_response import V1ListFilesystemSlurmJobsResponse
|
|
548
561
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_filesystem_snowflake_response import V1ListFilesystemSnowflakeResponse
|
|
549
562
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_gallery_components_response import V1ListGalleryComponentsResponse
|
|
@@ -652,6 +665,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_path_telemetry import V1Pat
|
|
|
652
665
|
from lightning_sdk.lightning_cloud.openapi.models.v1_phase_type import V1PhaseType
|
|
653
666
|
from lightning_sdk.lightning_cloud.openapi.models.v1_plugin import V1Plugin
|
|
654
667
|
from lightning_sdk.lightning_cloud.openapi.models.v1_plugins_list_response import V1PluginsListResponse
|
|
668
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_post_cloud_space_artifact_events_response import V1PostCloudSpaceArtifactEventsResponse
|
|
655
669
|
from lightning_sdk.lightning_cloud.openapi.models.v1_presigned_url import V1PresignedUrl
|
|
656
670
|
from lightning_sdk.lightning_cloud.openapi.models.v1_profiler_capture import V1ProfilerCapture
|
|
657
671
|
from lightning_sdk.lightning_cloud.openapi.models.v1_profiler_enabled_response import V1ProfilerEnabledResponse
|
|
@@ -43,6 +43,111 @@ class AssistantsServiceApi(object):
|
|
|
43
43
|
api_client = ApiClient()
|
|
44
44
|
self.api_client = api_client
|
|
45
45
|
|
|
46
|
+
def assistants_service_contact_assistant_owner(self, body: 'IdContactownerBody', id: 'str', **kwargs) -> 'V1ContactAssistantOwnerResponse': # noqa: E501
|
|
47
|
+
"""assistants_service_contact_assistant_owner # noqa: E501
|
|
48
|
+
|
|
49
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
50
|
+
asynchronous HTTP request, please pass async_req=True
|
|
51
|
+
>>> thread = api.assistants_service_contact_assistant_owner(body, id, async_req=True)
|
|
52
|
+
>>> result = thread.get()
|
|
53
|
+
|
|
54
|
+
:param async_req bool
|
|
55
|
+
:param IdContactownerBody body: (required)
|
|
56
|
+
:param str id: (required)
|
|
57
|
+
:return: V1ContactAssistantOwnerResponse
|
|
58
|
+
If the method is called asynchronously,
|
|
59
|
+
returns the request thread.
|
|
60
|
+
"""
|
|
61
|
+
kwargs['_return_http_data_only'] = True
|
|
62
|
+
if kwargs.get('async_req'):
|
|
63
|
+
return self.assistants_service_contact_assistant_owner_with_http_info(body, id, **kwargs) # noqa: E501
|
|
64
|
+
else:
|
|
65
|
+
(data) = self.assistants_service_contact_assistant_owner_with_http_info(body, id, **kwargs) # noqa: E501
|
|
66
|
+
return data
|
|
67
|
+
|
|
68
|
+
def assistants_service_contact_assistant_owner_with_http_info(self, body: 'IdContactownerBody', id: 'str', **kwargs) -> 'V1ContactAssistantOwnerResponse': # noqa: E501
|
|
69
|
+
"""assistants_service_contact_assistant_owner # noqa: E501
|
|
70
|
+
|
|
71
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
72
|
+
asynchronous HTTP request, please pass async_req=True
|
|
73
|
+
>>> thread = api.assistants_service_contact_assistant_owner_with_http_info(body, id, async_req=True)
|
|
74
|
+
>>> result = thread.get()
|
|
75
|
+
|
|
76
|
+
:param async_req bool
|
|
77
|
+
:param IdContactownerBody body: (required)
|
|
78
|
+
:param str id: (required)
|
|
79
|
+
:return: V1ContactAssistantOwnerResponse
|
|
80
|
+
If the method is called asynchronously,
|
|
81
|
+
returns the request thread.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
all_params = ['body', 'id'] # noqa: E501
|
|
85
|
+
all_params.append('async_req')
|
|
86
|
+
all_params.append('_return_http_data_only')
|
|
87
|
+
all_params.append('_preload_content')
|
|
88
|
+
all_params.append('_request_timeout')
|
|
89
|
+
|
|
90
|
+
params = locals()
|
|
91
|
+
for key, val in six.iteritems(params['kwargs']):
|
|
92
|
+
if key not in all_params:
|
|
93
|
+
raise TypeError(
|
|
94
|
+
"Got an unexpected keyword argument '%s'"
|
|
95
|
+
" to method assistants_service_contact_assistant_owner" % key
|
|
96
|
+
)
|
|
97
|
+
params[key] = val
|
|
98
|
+
del params['kwargs']
|
|
99
|
+
# verify the required parameter 'body' is set
|
|
100
|
+
if ('body' not in params or
|
|
101
|
+
params['body'] is None):
|
|
102
|
+
raise ValueError("Missing the required parameter `body` when calling `assistants_service_contact_assistant_owner`") # noqa: E501
|
|
103
|
+
# verify the required parameter 'id' is set
|
|
104
|
+
if ('id' not in params or
|
|
105
|
+
params['id'] is None):
|
|
106
|
+
raise ValueError("Missing the required parameter `id` when calling `assistants_service_contact_assistant_owner`") # noqa: E501
|
|
107
|
+
|
|
108
|
+
collection_formats = {}
|
|
109
|
+
|
|
110
|
+
path_params = {}
|
|
111
|
+
if 'id' in params:
|
|
112
|
+
path_params['id'] = params['id'] # noqa: E501
|
|
113
|
+
|
|
114
|
+
query_params = []
|
|
115
|
+
|
|
116
|
+
header_params = {}
|
|
117
|
+
|
|
118
|
+
form_params = []
|
|
119
|
+
local_var_files = {}
|
|
120
|
+
|
|
121
|
+
body_params = None
|
|
122
|
+
if 'body' in params:
|
|
123
|
+
body_params = params['body']
|
|
124
|
+
# HTTP header `Accept`
|
|
125
|
+
header_params['Accept'] = self.api_client.select_header_accept(
|
|
126
|
+
['application/json']) # noqa: E501
|
|
127
|
+
|
|
128
|
+
# HTTP header `Content-Type`
|
|
129
|
+
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
|
|
130
|
+
['application/json']) # noqa: E501
|
|
131
|
+
|
|
132
|
+
# Authentication setting
|
|
133
|
+
auth_settings = [] # noqa: E501
|
|
134
|
+
|
|
135
|
+
return self.api_client.call_api(
|
|
136
|
+
'/v1/agents/{id}/contact-owner', 'POST',
|
|
137
|
+
path_params,
|
|
138
|
+
query_params,
|
|
139
|
+
header_params,
|
|
140
|
+
body=body_params,
|
|
141
|
+
post_params=form_params,
|
|
142
|
+
files=local_var_files,
|
|
143
|
+
response_type='V1ContactAssistantOwnerResponse', # noqa: E501
|
|
144
|
+
auth_settings=auth_settings,
|
|
145
|
+
async_req=params.get('async_req'),
|
|
146
|
+
_return_http_data_only=params.get('_return_http_data_only'),
|
|
147
|
+
_preload_content=params.get('_preload_content', True),
|
|
148
|
+
_request_timeout=params.get('_request_timeout'),
|
|
149
|
+
collection_formats=collection_formats)
|
|
150
|
+
|
|
46
151
|
def assistants_service_create_assistant(self, body: 'ProjectIdAgentsBody', project_id: 'str', **kwargs) -> 'V1Assistant': # noqa: E501
|
|
47
152
|
"""assistants_service_create_assistant # noqa: E501
|
|
48
153
|
|