lightning-sdk 2025.10.8__py3-none-any.whl → 2025.10.22__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 +6 -3
- lightning_sdk/api/base_studio_api.py +13 -9
- lightning_sdk/api/cloud_account_api.py +0 -2
- lightning_sdk/api/license_api.py +26 -59
- lightning_sdk/api/studio_api.py +15 -2
- lightning_sdk/base_studio.py +30 -17
- lightning_sdk/cli/base_studio/list.py +1 -3
- lightning_sdk/cli/entrypoint.py +8 -34
- lightning_sdk/cli/studio/connect.py +42 -92
- lightning_sdk/cli/studio/create.py +23 -1
- lightning_sdk/cli/studio/start.py +12 -2
- lightning_sdk/cli/utils/get_base_studio.py +24 -0
- lightning_sdk/cli/utils/handle_machine_and_gpus_args.py +71 -0
- lightning_sdk/cli/utils/logging.py +121 -0
- lightning_sdk/cli/utils/ssh_connection.py +1 -1
- lightning_sdk/constants.py +1 -0
- lightning_sdk/helpers.py +53 -34
- lightning_sdk/job/job.py +5 -0
- lightning_sdk/job/v1.py +8 -0
- lightning_sdk/job/v2.py +8 -0
- lightning_sdk/lightning_cloud/login.py +260 -10
- lightning_sdk/lightning_cloud/openapi/__init__.py +30 -3
- lightning_sdk/lightning_cloud/openapi/api/__init__.py +1 -0
- lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +19 -19
- lightning_sdk/lightning_cloud/openapi/api/auth_service_api.py +97 -0
- lightning_sdk/lightning_cloud/openapi/api/cloud_space_service_api.py +105 -0
- lightning_sdk/lightning_cloud/openapi/api/k8_s_cluster_service_api.py +1463 -240
- lightning_sdk/lightning_cloud/openapi/api/product_license_service_api.py +108 -108
- lightning_sdk/lightning_cloud/openapi/api/sdk_command_history_service_api.py +141 -0
- lightning_sdk/lightning_cloud/openapi/models/__init__.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/cloudspace_id_visibility_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/cluster_id_metrics_body.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/create_machine_request_represents_the_request_to_create_a_machine.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/deployments_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/externalv1_cloud_space_instance_status.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/id_fork_body1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/id_transfer_body.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/incident_id_messages_body.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/incidents_id_body.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/license_key_validate_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/messages_message_id_body.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/project_id_incidents_body.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/projects_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/storage_complete_body.py +15 -15
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_transfer_metadata.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_create_license_request.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_project_request.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_create_sdk_command_history_request.py +253 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_sdk_command_history_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_incident_message_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_incident_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_license_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_deployment.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_external_cluster_spec.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_transfer_estimate_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_group_pod_metrics.py +1241 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident.py +565 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_detail.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_event.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_message.py +253 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_job.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_job_spec.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_kai_scheduler_queue_metrics.py +627 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_license.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_group_pod_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_incident_messages_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_incidents_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_kai_scheduler_queues_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/{v1_list_product_licenses_response.py → v1_list_license_response.py} +16 -16
- lightning_sdk/lightning_cloud/openapi/models/v1_machine.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_membership.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_membership.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_settings.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_resource_visibility.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_sdk_command_history_severity.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_sdk_command_history_type.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_server_alert_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_slack_notifier.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_token_login_request.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_token_login_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_token_owner_type.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +209 -131
- lightning_sdk/lightning_cloud/openapi/models/{v1_product_license_check_response.py → v1_validate_license_response.py} +21 -21
- lightning_sdk/lightning_cloud/rest_client.py +48 -45
- lightning_sdk/machine.py +2 -1
- lightning_sdk/studio.py +22 -2
- lightning_sdk/utils/license.py +13 -0
- {lightning_sdk-2025.10.8.dist-info → lightning_sdk-2025.10.22.dist-info}/METADATA +1 -1
- {lightning_sdk-2025.10.8.dist-info → lightning_sdk-2025.10.22.dist-info}/RECORD +94 -64
- lightning_sdk/lightning_cloud/openapi/models/v1_product_license.py +0 -435
- lightning_sdk/services/license.py +0 -363
- {lightning_sdk-2025.10.8.dist-info → lightning_sdk-2025.10.22.dist-info}/LICENSE +0 -0
- {lightning_sdk-2025.10.8.dist-info → lightning_sdk-2025.10.22.dist-info}/WHEEL +0 -0
- {lightning_sdk-2025.10.8.dist-info → lightning_sdk-2025.10.22.dist-info}/entry_points.txt +0 -0
- {lightning_sdk-2025.10.8.dist-info → lightning_sdk-2025.10.22.dist-info}/top_level.txt +0 -0
|
@@ -2,41 +2,43 @@ import functools
|
|
|
2
2
|
import logging
|
|
3
3
|
import time
|
|
4
4
|
from functools import wraps
|
|
5
|
-
from typing import Callable, Optional
|
|
5
|
+
from typing import Any, Callable, Optional
|
|
6
6
|
|
|
7
7
|
import urllib3
|
|
8
|
+
|
|
8
9
|
from lightning_sdk.lightning_cloud import env
|
|
9
10
|
from lightning_sdk.lightning_cloud.login import Auth
|
|
10
11
|
from lightning_sdk.lightning_cloud.openapi import (
|
|
11
12
|
ApiClient,
|
|
13
|
+
AssistantsServiceApi,
|
|
12
14
|
AuthServiceApi,
|
|
15
|
+
BillingServiceApi,
|
|
16
|
+
CloudSpaceEnvironmentTemplateServiceApi,
|
|
13
17
|
CloudSpaceServiceApi,
|
|
14
18
|
ClusterServiceApi,
|
|
15
19
|
Configuration,
|
|
16
20
|
DataConnectionServiceApi,
|
|
21
|
+
DatasetServiceApi,
|
|
22
|
+
DeploymentTemplatesServiceApi,
|
|
23
|
+
EndpointServiceApi,
|
|
24
|
+
JobsServiceApi,
|
|
17
25
|
LightningappInstanceServiceApi,
|
|
18
26
|
LightningappV2ServiceApi,
|
|
19
27
|
LightningworkServiceApi,
|
|
20
|
-
ProjectsServiceApi,
|
|
21
|
-
SecretServiceApi,
|
|
22
|
-
SSHPublicKeyServiceApi,
|
|
23
|
-
DatasetServiceApi,
|
|
24
|
-
OrganizationsServiceApi,
|
|
25
|
-
UserServiceApi,
|
|
26
|
-
BillingServiceApi,
|
|
27
|
-
EndpointServiceApi,
|
|
28
|
-
SlurmJobsUserServiceApi,
|
|
29
28
|
LitLoggerServiceApi,
|
|
30
|
-
JobsServiceApi,
|
|
31
|
-
AssistantsServiceApi,
|
|
32
|
-
StorageServiceApi,
|
|
33
|
-
DeploymentTemplatesServiceApi,
|
|
34
|
-
ModelsStoreApi,
|
|
35
29
|
LitRegistryServiceApi,
|
|
30
|
+
ModelsStoreApi,
|
|
31
|
+
OrganizationsServiceApi,
|
|
36
32
|
PipelinesServiceApi,
|
|
37
|
-
SchedulesServiceApi,
|
|
38
33
|
ProductLicenseServiceApi,
|
|
39
|
-
|
|
34
|
+
ProjectsServiceApi,
|
|
35
|
+
SchedulesServiceApi,
|
|
36
|
+
SDKCommandHistoryServiceApi,
|
|
37
|
+
SecretServiceApi,
|
|
38
|
+
SlurmJobsUserServiceApi,
|
|
39
|
+
SSHPublicKeyServiceApi,
|
|
40
|
+
StorageServiceApi,
|
|
41
|
+
UserServiceApi,
|
|
40
42
|
)
|
|
41
43
|
from lightning_sdk.lightning_cloud.openapi.rest import ApiException
|
|
42
44
|
from lightning_sdk.lightning_cloud.source_code.logs_socket_api import LightningLogsSocketAPI
|
|
@@ -76,34 +78,35 @@ def create_swagger_client(check_context: bool = True, with_auth: bool = True):
|
|
|
76
78
|
|
|
77
79
|
|
|
78
80
|
class GridRestClient(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
81
|
+
LightningLogsSocketAPI,
|
|
82
|
+
LightningappInstanceServiceApi,
|
|
83
|
+
LightningappV2ServiceApi,
|
|
84
|
+
AuthServiceApi,
|
|
85
|
+
CloudSpaceServiceApi,
|
|
86
|
+
ClusterServiceApi,
|
|
87
|
+
ProjectsServiceApi,
|
|
88
|
+
LightningworkServiceApi,
|
|
89
|
+
SecretServiceApi,
|
|
90
|
+
SSHPublicKeyServiceApi,
|
|
91
|
+
DataConnectionServiceApi,
|
|
92
|
+
DatasetServiceApi,
|
|
93
|
+
OrganizationsServiceApi,
|
|
94
|
+
UserServiceApi,
|
|
95
|
+
BillingServiceApi,
|
|
96
|
+
EndpointServiceApi,
|
|
97
|
+
SlurmJobsUserServiceApi,
|
|
98
|
+
LitLoggerServiceApi,
|
|
99
|
+
JobsServiceApi,
|
|
100
|
+
AssistantsServiceApi,
|
|
101
|
+
StorageServiceApi,
|
|
102
|
+
DeploymentTemplatesServiceApi,
|
|
103
|
+
ModelsStoreApi,
|
|
104
|
+
LitRegistryServiceApi,
|
|
105
|
+
PipelinesServiceApi,
|
|
106
|
+
SchedulesServiceApi,
|
|
107
|
+
ProductLicenseServiceApi,
|
|
108
|
+
CloudSpaceEnvironmentTemplateServiceApi,
|
|
109
|
+
SDKCommandHistoryServiceApi,
|
|
107
110
|
):
|
|
108
111
|
|
|
109
112
|
def __init__(self, api_client: Optional[ApiClient] = None, with_auth: bool = True):
|
lightning_sdk/machine.py
CHANGED
|
@@ -6,7 +6,6 @@ from typing import Any, ClassVar, Optional, Tuple
|
|
|
6
6
|
class CloudProvider(Enum):
|
|
7
7
|
AWS = "AWS"
|
|
8
8
|
GCP = "GCP"
|
|
9
|
-
VULTR = "VULTR"
|
|
10
9
|
LAMBDA_LABS = "LAMBDA_LABS"
|
|
11
10
|
DGX = "DGX"
|
|
12
11
|
VOLTAGE_PARK = "VOLTAGE_PARK"
|
|
@@ -35,6 +34,7 @@ class Machine:
|
|
|
35
34
|
|
|
36
35
|
# supported GPU types
|
|
37
36
|
# supported T4 variations
|
|
37
|
+
T4_SMALL: ClassVar["Machine"]
|
|
38
38
|
T4: ClassVar["Machine"]
|
|
39
39
|
T4_X_2: ClassVar["Machine"]
|
|
40
40
|
T4_X_4: ClassVar["Machine"]
|
|
@@ -163,6 +163,7 @@ Machine.DATA_PREP_ULTRA = Machine(
|
|
|
163
163
|
|
|
164
164
|
# GPU machines
|
|
165
165
|
# available T4 machines
|
|
166
|
+
Machine.T4_SMALL = Machine(name="T4_SMALL", slug="lit-t4-1-small", family="T4", accelerator_count=1)
|
|
166
167
|
Machine.T4 = Machine(name="T4", slug="lit-t4-1", family="T4", accelerator_count=1)
|
|
167
168
|
Machine.T4_X_2 = Machine(name="T4_X_2", slug="lit-t4-2", family="T4", accelerator_count=2)
|
|
168
169
|
Machine.T4_X_4 = Machine(name="T4_X_4", slug="lit-t4-4", family="T4", accelerator_count=4)
|
lightning_sdk/studio.py
CHANGED
|
@@ -119,7 +119,7 @@ class Studio:
|
|
|
119
119
|
|
|
120
120
|
self._studio_type = None
|
|
121
121
|
if studio_type:
|
|
122
|
-
self._base_studio = BaseStudio()
|
|
122
|
+
self._base_studio = BaseStudio(teamspace=self._teamspace)
|
|
123
123
|
self._available_base_studios = self._base_studio.list()
|
|
124
124
|
for bst in self._available_base_studios:
|
|
125
125
|
if (
|
|
@@ -242,6 +242,14 @@ class Studio:
|
|
|
242
242
|
_get_org_id(self._teamspace),
|
|
243
243
|
)
|
|
244
244
|
|
|
245
|
+
@property
|
|
246
|
+
def public_ip(self) -> Optional[str]:
|
|
247
|
+
"""Returns the public IP address of the machine the Studio is running on."""
|
|
248
|
+
return self._studio_api.get_public_ip(
|
|
249
|
+
self._studio.id,
|
|
250
|
+
self._teamspace.id,
|
|
251
|
+
)
|
|
252
|
+
|
|
245
253
|
@property
|
|
246
254
|
def interruptible(self) -> bool:
|
|
247
255
|
"""Returns whether the Studio is running on a interruptible instance."""
|
|
@@ -345,7 +353,10 @@ class Studio:
|
|
|
345
353
|
self._studio_api.delete_studio(self._studio.id, self._teamspace.id)
|
|
346
354
|
|
|
347
355
|
def duplicate(
|
|
348
|
-
self,
|
|
356
|
+
self,
|
|
357
|
+
target_teamspace: Optional[Union["Teamspace", str]] = None,
|
|
358
|
+
machine: Machine = Machine.CPU,
|
|
359
|
+
name: Optional[str] = None,
|
|
349
360
|
) -> "Studio":
|
|
350
361
|
"""Duplicates the existing Studio.
|
|
351
362
|
|
|
@@ -378,6 +389,7 @@ class Studio:
|
|
|
378
389
|
teamspace_id=self._teamspace.id,
|
|
379
390
|
target_teamspace_id=target_teamspace_id,
|
|
380
391
|
machine=machine,
|
|
392
|
+
new_name=name,
|
|
381
393
|
)
|
|
382
394
|
return Studio(**kwargs)
|
|
383
395
|
|
|
@@ -651,6 +663,14 @@ class Studio:
|
|
|
651
663
|
self._assistant_id = assistant.id
|
|
652
664
|
_logger.info(assistant_info)
|
|
653
665
|
|
|
666
|
+
def rename(self, new_name: str) -> None:
|
|
667
|
+
"""Renames the current Studio to the provided new name."""
|
|
668
|
+
if new_name == self._studio.name:
|
|
669
|
+
return
|
|
670
|
+
|
|
671
|
+
self._studio_api._update_cloudspace(self._studio, self._teamspace.id, "display_name", new_name)
|
|
672
|
+
self._update_studio_reference()
|
|
673
|
+
|
|
654
674
|
@property
|
|
655
675
|
def auto_sleep(self) -> bool:
|
|
656
676
|
"""Returns if a Studio has auto-sleep enabled."""
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from functools import lru_cache
|
|
2
|
+
|
|
3
|
+
from lightning_sdk.api.license_api import LicenseApi
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class License:
|
|
7
|
+
def __init__(self, license_key: str, product_name: str) -> None:
|
|
8
|
+
self.license_key = license_key
|
|
9
|
+
self.product_name = product_name
|
|
10
|
+
|
|
11
|
+
@lru_cache(maxsize=1) # noqa: B019
|
|
12
|
+
def validate(self) -> bool:
|
|
13
|
+
return LicenseApi(self.license_key).validate_license(self.license_key, self.product_name)
|