lightning-sdk 2025.7.17__py3-none-any.whl → 2025.7.30rc0__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 +3 -2
- lightning_sdk/api/cloud_account_api.py +204 -0
- lightning_sdk/api/deployment_api.py +11 -0
- lightning_sdk/api/job_api.py +82 -10
- lightning_sdk/api/llm_api.py +1 -1
- lightning_sdk/api/mmt_api.py +44 -5
- lightning_sdk/api/pipeline_api.py +4 -3
- lightning_sdk/api/studio_api.py +51 -8
- lightning_sdk/api/utils.py +6 -2
- lightning_sdk/cli/clusters_menu.py +3 -3
- lightning_sdk/cli/create.py +25 -11
- lightning_sdk/cli/deploy/_auth.py +19 -3
- lightning_sdk/cli/deploy/serve.py +21 -5
- lightning_sdk/cli/download.py +25 -1
- lightning_sdk/cli/entrypoint.py +4 -2
- lightning_sdk/cli/list.py +5 -1
- lightning_sdk/cli/run.py +3 -1
- lightning_sdk/cli/start.py +40 -8
- lightning_sdk/cli/switch.py +3 -1
- lightning_sdk/deployment/deployment.py +8 -0
- lightning_sdk/job/base.py +27 -3
- lightning_sdk/job/job.py +28 -4
- lightning_sdk/job/v1.py +10 -1
- lightning_sdk/job/v2.py +22 -2
- lightning_sdk/job/work.py +5 -1
- lightning_sdk/lightning_cloud/openapi/__init__.py +14 -1
- lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +428 -0
- lightning_sdk/lightning_cloud/openapi/api/billing_service_api.py +153 -48
- lightning_sdk/lightning_cloud/openapi/api/cloudy_service_api.py +295 -0
- lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +93 -0
- lightning_sdk/lightning_cloud/openapi/models/__init__.py +14 -1
- lightning_sdk/lightning_cloud/openapi/models/agentmanagedendpoints_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/blogposts_id_body.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/conversations_id_body1.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/messages_id_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/metricsstream_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/project_id_schedules_body.py +81 -3
- lightning_sdk/lightning_cloud/openapi/models/schedules_id_body.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/user_id_upgradetrigger_body.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/user_user_id_body.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_billing_subscription.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_blog_post.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cloudy_settings.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_spec.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_conversation.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_conversation_response_chunk.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_create_billing_upgrade_trigger_record_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_blog_post_request.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_create_checkout_session_request.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_create_subscription_checkout_session_request.py +55 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_function_call.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/{v1_get_clickhouse_assistant_session_daily_aggregated_response.py → v1_get_assistant_session_daily_aggregated_response.py} +22 -22
- lightning_sdk/lightning_cloud/openapi/models/v1_get_cluster_health_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_job_spec.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_v1.py +105 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_like_status.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_published_managed_endpoints_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_managed_endpoint.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_managed_model.py +95 -17
- lightning_sdk/lightning_cloud/openapi/models/v1_message.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_quote_subscription_response.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_resource_visibility.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_response_choice.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_schedule.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_service_health.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_slurm_v1.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_slurm_v1_status.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_tool_call.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_conversation_like_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_conversation_message_like_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +79 -313
- lightning_sdk/lightning_cloud/openapi/models/v1_volume_state.py +1 -0
- lightning_sdk/llm/llm.py +69 -11
- lightning_sdk/llm/public_assistants.json +32 -8
- lightning_sdk/machine.py +151 -43
- lightning_sdk/mmt/base.py +20 -2
- lightning_sdk/mmt/mmt.py +25 -3
- lightning_sdk/mmt/v1.py +7 -1
- lightning_sdk/mmt/v2.py +27 -3
- lightning_sdk/models.py +1 -1
- lightning_sdk/organization.py +4 -0
- lightning_sdk/pipeline/pipeline.py +16 -5
- lightning_sdk/pipeline/printer.py +5 -3
- lightning_sdk/pipeline/schedule.py +844 -1
- lightning_sdk/pipeline/steps.py +19 -4
- lightning_sdk/sandbox.py +4 -1
- lightning_sdk/serve.py +2 -0
- lightning_sdk/studio.py +91 -44
- lightning_sdk/teamspace.py +19 -10
- lightning_sdk/utils/resolve.py +37 -2
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.30rc0.dist-info}/METADATA +7 -5
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.30rc0.dist-info}/RECORD +98 -85
- lightning_sdk/api/cluster_api.py +0 -119
- /lightning_sdk/cli/{inspect.py → inspection.py} +0 -0
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.30rc0.dist-info}/LICENSE +0 -0
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.30rc0.dist-info}/WHEEL +0 -0
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.30rc0.dist-info}/entry_points.txt +0 -0
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.30rc0.dist-info}/top_level.txt +0 -0
lightning_sdk/job/base.py
CHANGED
|
@@ -2,11 +2,12 @@ import warnings
|
|
|
2
2
|
from abc import ABC, abstractmethod
|
|
3
3
|
from typing import TYPE_CHECKING, Any, Dict, Optional, TypedDict, Union
|
|
4
4
|
|
|
5
|
+
from lightning_sdk.api.cloud_account_api import CloudAccountApi
|
|
5
6
|
from lightning_sdk.api.utils import _get_cloud_url
|
|
6
7
|
from lightning_sdk.utils.resolve import _resolve_deprecated_cluster, _resolve_teamspace, in_studio
|
|
7
8
|
|
|
8
9
|
if TYPE_CHECKING:
|
|
9
|
-
from lightning_sdk.machine import Machine
|
|
10
|
+
from lightning_sdk.machine import CloudProvider, Machine
|
|
10
11
|
from lightning_sdk.organization import Organization
|
|
11
12
|
from lightning_sdk.status import Status
|
|
12
13
|
from lightning_sdk.studio import Studio
|
|
@@ -64,6 +65,7 @@ class _BaseJob(ABC):
|
|
|
64
65
|
self._update_internal_job()
|
|
65
66
|
|
|
66
67
|
self._prevent_refetch_latest = False
|
|
68
|
+
self._cloud_account_api = CloudAccountApi()
|
|
67
69
|
|
|
68
70
|
@classmethod
|
|
69
71
|
def run(
|
|
@@ -77,6 +79,7 @@ class _BaseJob(ABC):
|
|
|
77
79
|
org: Union[str, "Organization", None] = None,
|
|
78
80
|
user: Union[str, "User", None] = None,
|
|
79
81
|
cloud_account: Optional[str] = None,
|
|
82
|
+
cloud_provider: Optional[Union["CloudProvider", str]] = None,
|
|
80
83
|
env: Optional[Dict[str, str]] = None,
|
|
81
84
|
interruptible: bool = False,
|
|
82
85
|
image_credentials: Optional[str] = None,
|
|
@@ -85,6 +88,7 @@ class _BaseJob(ABC):
|
|
|
85
88
|
artifacts_remote: Optional[str] = None,
|
|
86
89
|
entrypoint: str = "sh -c",
|
|
87
90
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
91
|
+
max_runtime: Optional[int] = None,
|
|
88
92
|
cluster: Optional[str] = None, # deprecated in favor of cloud_account
|
|
89
93
|
) -> "_BaseJob":
|
|
90
94
|
"""Run async workloads using a docker image or a compute environment from your studio.
|
|
@@ -101,7 +105,11 @@ class _BaseJob(ABC):
|
|
|
101
105
|
user: The user owning the teamspace (if any). Defaults to the current user.
|
|
102
106
|
cloud_account: The cloud account to run the job on.
|
|
103
107
|
Defaults to the studio cloud account if running with studio compute env.
|
|
104
|
-
If not provided
|
|
108
|
+
If not provided and `cloud_account_provider` is set, will resolve cluster from this, else
|
|
109
|
+
will fall back to the teamspaces default cloud account.
|
|
110
|
+
cloud_account_provider: The provider to select the cloud-account from.
|
|
111
|
+
If set, must be in agreement with the provider from the cloud_account (if specified).
|
|
112
|
+
If not specified, falls backto the teamspace default cloud account.
|
|
105
113
|
env: Environment variables to set inside the job.
|
|
106
114
|
interruptible: Whether the job should run on interruptible instances. They are cheaper but can be preempted.
|
|
107
115
|
image_credentials: The credentials used to pull the image. Required if the image is private.
|
|
@@ -122,6 +130,10 @@ class _BaseJob(ABC):
|
|
|
122
130
|
just runs the provided command in a standard shell.
|
|
123
131
|
To use the pre-defined entrypoint of the provided image, set this to an empty string.
|
|
124
132
|
Only applicable when submitting docker jobs.
|
|
133
|
+
max_runtime: the duration (in seconds) for which to allocate the machine.
|
|
134
|
+
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
135
|
+
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
136
|
+
Defaults to 3h
|
|
125
137
|
"""
|
|
126
138
|
from lightning_sdk.lightning_cloud.openapi.rest import ApiException
|
|
127
139
|
from lightning_sdk.studio import Studio
|
|
@@ -199,6 +211,7 @@ class _BaseJob(ABC):
|
|
|
199
211
|
return inst._submit(
|
|
200
212
|
machine=machine,
|
|
201
213
|
cloud_account=cloud_account,
|
|
214
|
+
cloud_provider=cloud_provider,
|
|
202
215
|
command=command,
|
|
203
216
|
studio=studio,
|
|
204
217
|
image=image,
|
|
@@ -210,6 +223,7 @@ class _BaseJob(ABC):
|
|
|
210
223
|
artifacts_remote=artifacts_remote,
|
|
211
224
|
entrypoint=entrypoint,
|
|
212
225
|
path_mappings=path_mappings,
|
|
226
|
+
max_runtime=max_runtime,
|
|
213
227
|
)
|
|
214
228
|
|
|
215
229
|
@abstractmethod
|
|
@@ -222,12 +236,14 @@ class _BaseJob(ABC):
|
|
|
222
236
|
env: Optional[Dict[str, str]] = None,
|
|
223
237
|
interruptible: bool = False,
|
|
224
238
|
cloud_account: Optional[str] = None,
|
|
239
|
+
cloud_provider: Optional[Union["CloudProvider", str]] = None,
|
|
225
240
|
image_credentials: Optional[str] = None,
|
|
226
241
|
cloud_account_auth: bool = False,
|
|
227
242
|
artifacts_local: Optional[str] = None,
|
|
228
243
|
artifacts_remote: Optional[str] = None,
|
|
229
244
|
entrypoint: str = "sh -c",
|
|
230
245
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
246
|
+
max_runtime: Optional[int] = None,
|
|
231
247
|
) -> "_BaseJob":
|
|
232
248
|
"""Submit a new job to the Lightning AI platform.
|
|
233
249
|
|
|
@@ -241,7 +257,11 @@ class _BaseJob(ABC):
|
|
|
241
257
|
interruptible: Whether the job should run on interruptible instances. They are cheaper but can be preempted.
|
|
242
258
|
cloud_account: The cloud account to run the job on.
|
|
243
259
|
Defaults to the studio cloud account if running with studio compute env.
|
|
244
|
-
If not provided
|
|
260
|
+
If not provided and `cloud_account_provider` is set, will resolve cluster from this, else
|
|
261
|
+
will fall back to the teamspaces default cloud account.
|
|
262
|
+
cloud_account_provider: The provider to select the cloud-account from.
|
|
263
|
+
If set, must be in agreement with the provider from the cloud_account (if specified).
|
|
264
|
+
If not specified, falls backto the teamspace default cloud account.
|
|
245
265
|
image_credentials: The credentials used to pull the image. Required if the image is private.
|
|
246
266
|
This should be the name of the respective credentials secret created on the Lightning AI platform.
|
|
247
267
|
cloud_account_auth: Whether to authenticate with the cloud account to pull the image.
|
|
@@ -259,6 +279,10 @@ class _BaseJob(ABC):
|
|
|
259
279
|
entrypoint: The entrypoint of your docker container. Defaults to sh -c.
|
|
260
280
|
To use the pre-defined entrypoint of the provided image, set this to an empty string.
|
|
261
281
|
Only applicable when submitting docker jobs.
|
|
282
|
+
max_runtime: the duration (in seconds) for which to allocate the machine.
|
|
283
|
+
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
284
|
+
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
285
|
+
Defaults to 3h
|
|
262
286
|
"""
|
|
263
287
|
|
|
264
288
|
@abstractmethod
|
lightning_sdk/job/job.py
CHANGED
|
@@ -8,7 +8,7 @@ from lightning_sdk.utils.resolve import _setup_logger
|
|
|
8
8
|
_logger = _setup_logger(__name__)
|
|
9
9
|
|
|
10
10
|
if TYPE_CHECKING:
|
|
11
|
-
from lightning_sdk.machine import Machine
|
|
11
|
+
from lightning_sdk.machine import CloudProvider, Machine
|
|
12
12
|
from lightning_sdk.organization import Organization
|
|
13
13
|
from lightning_sdk.status import Status
|
|
14
14
|
from lightning_sdk.studio import Studio
|
|
@@ -86,12 +86,14 @@ class Job(_BaseJob):
|
|
|
86
86
|
org: Union[str, "Organization", None] = None,
|
|
87
87
|
user: Union[str, "User", None] = None,
|
|
88
88
|
cloud_account: Optional[str] = None,
|
|
89
|
+
cloud_provider: Optional[Union["CloudProvider", str]] = None,
|
|
89
90
|
env: Optional[Dict[str, str]] = None,
|
|
90
91
|
interruptible: bool = False,
|
|
91
92
|
image_credentials: Optional[str] = None,
|
|
92
93
|
cloud_account_auth: bool = False,
|
|
93
94
|
entrypoint: str = "sh -c",
|
|
94
95
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
96
|
+
max_runtime: Optional[int] = None,
|
|
95
97
|
artifacts_local: Optional[str] = None, # deprecated in terms of path_mappings
|
|
96
98
|
artifacts_remote: Optional[str] = None, # deprecated in terms of path_mappings
|
|
97
99
|
cluster: Optional[str] = None, # deprecated in favor of cloud_account
|
|
@@ -108,9 +110,13 @@ class Job(_BaseJob):
|
|
|
108
110
|
teamspace: The teamspace the job should be associated with. Defaults to the current teamspace.
|
|
109
111
|
org: The organization owning the teamspace (if any). Defaults to the current organization.
|
|
110
112
|
user: The user owning the teamspace (if any). Defaults to the current user.
|
|
111
|
-
cloud_account: The cloud
|
|
113
|
+
cloud_account: The cloud account to run the job on.
|
|
112
114
|
Defaults to the studio cloud account if running with studio compute env.
|
|
113
|
-
|
|
115
|
+
If not provided and `cloud_account_provider` is set, will resolve cluster from this, else
|
|
116
|
+
will fall back to the teamspaces default cloud account.
|
|
117
|
+
cloud_account_provider: The provider to select the cloud-account from.
|
|
118
|
+
If set, must be in agreement with the provider from the cloud_account (if specified).
|
|
119
|
+
If not specified, falls backto the teamspace default cloud account.
|
|
114
120
|
env: Environment variables to set inside the job.
|
|
115
121
|
interruptible: Whether the job should run on interruptible instances. They are cheaper but can be preempted.
|
|
116
122
|
image_credentials: The credentials used to pull the image. Required if the image is private.
|
|
@@ -130,6 +136,10 @@ class Job(_BaseJob):
|
|
|
130
136
|
}
|
|
131
137
|
If the path inside the connection is omitted it's assumed to be the root path of that connection.
|
|
132
138
|
Only applicable when submitting docker jobs.
|
|
139
|
+
max_runtime: the duration (in seconds) for which to allocate the machine.
|
|
140
|
+
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
141
|
+
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
142
|
+
Defaults to 3h
|
|
133
143
|
"""
|
|
134
144
|
ret_val = super().run(
|
|
135
145
|
name=name,
|
|
@@ -141,6 +151,7 @@ class Job(_BaseJob):
|
|
|
141
151
|
org=org,
|
|
142
152
|
user=user,
|
|
143
153
|
cloud_account=cloud_account,
|
|
154
|
+
cloud_provider=cloud_provider,
|
|
144
155
|
env=env,
|
|
145
156
|
interruptible=interruptible,
|
|
146
157
|
image_credentials=image_credentials,
|
|
@@ -149,6 +160,7 @@ class Job(_BaseJob):
|
|
|
149
160
|
artifacts_remote=artifacts_remote,
|
|
150
161
|
entrypoint=entrypoint,
|
|
151
162
|
path_mappings=path_mappings,
|
|
163
|
+
max_runtime=max_runtime,
|
|
152
164
|
cluster=cluster,
|
|
153
165
|
)
|
|
154
166
|
# required for typing with "Job"
|
|
@@ -166,12 +178,14 @@ class Job(_BaseJob):
|
|
|
166
178
|
env: Optional[Dict[str, str]] = None,
|
|
167
179
|
interruptible: bool = False,
|
|
168
180
|
cloud_account: Optional[str] = None,
|
|
181
|
+
cloud_provider: Optional[Union["CloudProvider", str]] = None,
|
|
169
182
|
image_credentials: Optional[str] = None,
|
|
170
183
|
cloud_account_auth: bool = False,
|
|
171
184
|
entrypoint: str = "sh -c",
|
|
172
185
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
173
186
|
artifacts_local: Optional[str] = None, # deprecated in terms of path_mappings
|
|
174
187
|
artifacts_remote: Optional[str] = None, # deprecated in terms of path_mappings
|
|
188
|
+
max_runtime: Optional[int] = None,
|
|
175
189
|
) -> "Job":
|
|
176
190
|
"""Submit a new job to the Lightning AI platform.
|
|
177
191
|
|
|
@@ -185,7 +199,11 @@ class Job(_BaseJob):
|
|
|
185
199
|
interruptible: Whether the job should run on interruptible instances. They are cheaper but can be preempted.
|
|
186
200
|
cloud_account: The cloud account to run the job on.
|
|
187
201
|
Defaults to the studio cloud account if running with studio compute env.
|
|
188
|
-
If not provided
|
|
202
|
+
If not provided and `cloud_account_provider` is set, will resolve cluster from this, else
|
|
203
|
+
will fall back to the teamspaces default cloud account.
|
|
204
|
+
cloud_account_provider: The provider to select the cloud-account from.
|
|
205
|
+
If set, must be in agreement with the provider from the cloud_account (if specified).
|
|
206
|
+
If not specified, falls backto the teamspace default cloud account.
|
|
189
207
|
image_credentials: The credentials used to pull the image. Required if the image is private.
|
|
190
208
|
This should be the name of the respective credentials secret created on the Lightning AI platform.
|
|
191
209
|
cloud_account_auth: Whether to authenticate with the cloud account to pull the image.
|
|
@@ -202,10 +220,15 @@ class Job(_BaseJob):
|
|
|
202
220
|
}
|
|
203
221
|
If the path inside the connection is omitted it's assumed to be the root path of that connection.
|
|
204
222
|
Only applicable when submitting docker jobs.
|
|
223
|
+
max_runtime: the duration (in seconds) for which to allocate the machine.
|
|
224
|
+
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
225
|
+
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
226
|
+
Defaults to 3h
|
|
205
227
|
"""
|
|
206
228
|
self._job = self._internal_job._submit(
|
|
207
229
|
machine=machine,
|
|
208
230
|
cloud_account=cloud_account,
|
|
231
|
+
cloud_provider=cloud_provider,
|
|
209
232
|
command=command,
|
|
210
233
|
studio=studio,
|
|
211
234
|
image=image,
|
|
@@ -217,6 +240,7 @@ class Job(_BaseJob):
|
|
|
217
240
|
path_mappings=path_mappings,
|
|
218
241
|
artifacts_local=artifacts_local,
|
|
219
242
|
artifacts_remote=artifacts_remote,
|
|
243
|
+
max_runtime=max_runtime,
|
|
220
244
|
)
|
|
221
245
|
return self
|
|
222
246
|
|
lightning_sdk/job/v1.py
CHANGED
|
@@ -5,7 +5,7 @@ from lightning_sdk.job.base import _BaseJob
|
|
|
5
5
|
from lightning_sdk.status import Status
|
|
6
6
|
|
|
7
7
|
if TYPE_CHECKING:
|
|
8
|
-
from lightning_sdk.machine import Machine
|
|
8
|
+
from lightning_sdk.machine import CloudProvider, Machine
|
|
9
9
|
from lightning_sdk.organization import Organization
|
|
10
10
|
from lightning_sdk.studio import Studio
|
|
11
11
|
from lightning_sdk.teamspace import Teamspace
|
|
@@ -51,6 +51,7 @@ class _JobV1(_BaseJob):
|
|
|
51
51
|
org: Union[str, "Organization", None] = None,
|
|
52
52
|
user: Union[str, "User", None] = None,
|
|
53
53
|
cloud_account: Optional[str] = None,
|
|
54
|
+
cloud_provider: Optional[str] = None,
|
|
54
55
|
interruptible: bool = False,
|
|
55
56
|
cluster: Optional[str] = None, # deprecated in favor of cloud_account
|
|
56
57
|
) -> "_BaseJob":
|
|
@@ -80,12 +81,14 @@ class _JobV1(_BaseJob):
|
|
|
80
81
|
org=org,
|
|
81
82
|
user=user,
|
|
82
83
|
cloud_account=cloud_account,
|
|
84
|
+
cloud_provider=cloud_provider,
|
|
83
85
|
env=None,
|
|
84
86
|
interruptible=interruptible,
|
|
85
87
|
image_credentials=None,
|
|
86
88
|
cloud_account_auth=False,
|
|
87
89
|
cluster=cluster,
|
|
88
90
|
path_mappings=None,
|
|
91
|
+
max_runtime=None,
|
|
89
92
|
)
|
|
90
93
|
|
|
91
94
|
def _submit(
|
|
@@ -97,12 +100,14 @@ class _JobV1(_BaseJob):
|
|
|
97
100
|
env: Optional[Dict[str, str]] = None,
|
|
98
101
|
interruptible: bool = False,
|
|
99
102
|
cloud_account: Optional[str] = None,
|
|
103
|
+
cloud_provider: Optional[Union["CloudProvider", str]] = None,
|
|
100
104
|
image_credentials: Optional[str] = None,
|
|
101
105
|
cloud_account_auth: bool = False,
|
|
102
106
|
artifacts_local: Optional[str] = None,
|
|
103
107
|
artifacts_remote: Optional[str] = None,
|
|
104
108
|
entrypoint: str = "sh -c",
|
|
105
109
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
110
|
+
max_runtime: Optional[int] = None,
|
|
106
111
|
) -> "_JobV1":
|
|
107
112
|
"""Submit a job to run on a machine.
|
|
108
113
|
|
|
@@ -121,6 +126,10 @@ class _JobV1(_BaseJob):
|
|
|
121
126
|
To use the pre-defined entrypoint of the provided image, set this to an empty string.
|
|
122
127
|
Only applicable when submitting docker jobs.
|
|
123
128
|
path_mappings: The mappings from data connection inside your container (not supported)
|
|
129
|
+
max_runtime: the duration (in seconds) for which to allocate the machine.
|
|
130
|
+
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
131
|
+
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
132
|
+
Defaults to 3h
|
|
124
133
|
|
|
125
134
|
Returns:
|
|
126
135
|
The submitted job.
|
lightning_sdk/job/v2.py
CHANGED
|
@@ -4,9 +4,10 @@ from lightning_sdk.api.job_api import JobApiV2
|
|
|
4
4
|
from lightning_sdk.api.utils import _get_cloud_url
|
|
5
5
|
from lightning_sdk.job.base import _BaseJob
|
|
6
6
|
from lightning_sdk.status import Status
|
|
7
|
+
from lightning_sdk.utils.resolve import _get_org_id
|
|
7
8
|
|
|
8
9
|
if TYPE_CHECKING:
|
|
9
|
-
from lightning_sdk.machine import Machine
|
|
10
|
+
from lightning_sdk.machine import CloudProvider, Machine
|
|
10
11
|
from lightning_sdk.organization import Organization
|
|
11
12
|
from lightning_sdk.studio import Studio
|
|
12
13
|
from lightning_sdk.teamspace import Teamspace
|
|
@@ -44,10 +45,12 @@ class _JobV2(_BaseJob):
|
|
|
44
45
|
env: Optional[Dict[str, str]] = None,
|
|
45
46
|
interruptible: bool = False,
|
|
46
47
|
cloud_account: Optional[str] = None,
|
|
48
|
+
cloud_provider: Optional[Union["CloudProvider", str]] = None,
|
|
47
49
|
image_credentials: Optional[str] = None,
|
|
48
50
|
cloud_account_auth: bool = False,
|
|
49
51
|
entrypoint: str = "sh -c",
|
|
50
52
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
53
|
+
max_runtime: Optional[int] = None,
|
|
51
54
|
artifacts_local: Optional[str] = None, # deprecated in favor of path_mappings
|
|
52
55
|
artifacts_remote: Optional[str] = None, # deprecated in favor of path_mappings
|
|
53
56
|
) -> "_JobV2":
|
|
@@ -80,6 +83,10 @@ class _JobV2(_BaseJob):
|
|
|
80
83
|
}
|
|
81
84
|
If the path inside the connection is omitted it's assumed to be the root path of that connection.
|
|
82
85
|
Only applicable when submitting docker jobs.
|
|
86
|
+
max_runtime: the duration (in seconds) for which to allocate the machine.
|
|
87
|
+
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
88
|
+
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
89
|
+
Defaults to 3h
|
|
83
90
|
"""
|
|
84
91
|
# Command is required if Studio is provided to know what to run
|
|
85
92
|
# Image is mutually exclusive with Studio
|
|
@@ -98,6 +105,13 @@ class _JobV2(_BaseJob):
|
|
|
98
105
|
if image is None:
|
|
99
106
|
raise ValueError("either image or studio must be provided")
|
|
100
107
|
|
|
108
|
+
cloud_account = self._cloud_account_api.resolve_cloud_account(
|
|
109
|
+
self._teamspace.id,
|
|
110
|
+
cloud_account=cloud_account,
|
|
111
|
+
cloud_provider=cloud_provider,
|
|
112
|
+
default_cloud_account=self._teamspace.default_cloud_account,
|
|
113
|
+
)
|
|
114
|
+
|
|
101
115
|
submitted = self._job_api.submit_job(
|
|
102
116
|
name=self.name,
|
|
103
117
|
command=command,
|
|
@@ -114,6 +128,7 @@ class _JobV2(_BaseJob):
|
|
|
114
128
|
artifacts_remote=artifacts_remote,
|
|
115
129
|
entrypoint=entrypoint,
|
|
116
130
|
path_mappings=path_mappings,
|
|
131
|
+
max_runtime=max_runtime,
|
|
117
132
|
)
|
|
118
133
|
self._job = submitted
|
|
119
134
|
self._name = submitted.name
|
|
@@ -151,7 +166,12 @@ class _JobV2(_BaseJob):
|
|
|
151
166
|
def machine(self) -> Union["Machine", str]:
|
|
152
167
|
"""The machine type the job is running on."""
|
|
153
168
|
# only fetch the job it it hasn't been fetched yet as machine cannot change over time
|
|
154
|
-
|
|
169
|
+
|
|
170
|
+
return self._job_api._get_job_machine_from_spec(
|
|
171
|
+
self._guaranteed_job.spec,
|
|
172
|
+
self.teamspace.id,
|
|
173
|
+
_get_org_id(self.teamspace),
|
|
174
|
+
)
|
|
155
175
|
|
|
156
176
|
@property
|
|
157
177
|
def artifact_path(self) -> Optional[str]:
|
lightning_sdk/job/work.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import TYPE_CHECKING, Any, Optional, Protocol, Union
|
|
2
2
|
|
|
3
3
|
from lightning_sdk.api.job_api import JobApiV1
|
|
4
|
+
from lightning_sdk.utils.resolve import _get_org_id
|
|
4
5
|
|
|
5
6
|
if TYPE_CHECKING:
|
|
6
7
|
from lightning_sdk.job.base import MachineDict
|
|
@@ -52,7 +53,10 @@ class Work:
|
|
|
52
53
|
|
|
53
54
|
@property
|
|
54
55
|
def machine(self) -> Union["Machine", str]:
|
|
55
|
-
return self._job_api.get_machine_from_work(
|
|
56
|
+
return self._job_api.get_machine_from_work(
|
|
57
|
+
self._guaranteed_work,
|
|
58
|
+
org_id=_get_org_id(self._teamspace),
|
|
59
|
+
)
|
|
56
60
|
|
|
57
61
|
@property
|
|
58
62
|
def artifact_path(self) -> Optional[str]:
|
|
@@ -102,6 +102,7 @@ from lightning_sdk.lightning_cloud.openapi.models.clusters_id_body import Cluste
|
|
|
102
102
|
from lightning_sdk.lightning_cloud.openapi.models.clusters_id_body1 import ClustersIdBody1
|
|
103
103
|
from lightning_sdk.lightning_cloud.openapi.models.command_argument_command_argument_type import CommandArgumentCommandArgumentType
|
|
104
104
|
from lightning_sdk.lightning_cloud.openapi.models.conversations_id_body import ConversationsIdBody
|
|
105
|
+
from lightning_sdk.lightning_cloud.openapi.models.conversations_id_body1 import ConversationsIdBody1
|
|
105
106
|
from lightning_sdk.lightning_cloud.openapi.models.create import Create
|
|
106
107
|
from lightning_sdk.lightning_cloud.openapi.models.create_checkout_session_request_wallet_type import CreateCheckoutSessionRequestWalletType
|
|
107
108
|
from lightning_sdk.lightning_cloud.openapi.models.create_deployment_request_defines_a_spec_for_the_job_that_allows_for_autoscaling_jobs import CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs
|
|
@@ -165,6 +166,7 @@ from lightning_sdk.lightning_cloud.openapi.models.litloggermetrics_id_body impor
|
|
|
165
166
|
from lightning_sdk.lightning_cloud.openapi.models.litpages_id_body import LitpagesIdBody
|
|
166
167
|
from lightning_sdk.lightning_cloud.openapi.models.litregistry_lit_repo_name_body import LitregistryLitRepoNameBody
|
|
167
168
|
from lightning_sdk.lightning_cloud.openapi.models.loggermetrics_id_body import LoggermetricsIdBody
|
|
169
|
+
from lightning_sdk.lightning_cloud.openapi.models.messages_id_body import MessagesIdBody
|
|
168
170
|
from lightning_sdk.lightning_cloud.openapi.models.metrics_stream_id_loggerartifacts_body import MetricsStreamIdLoggerartifactsBody
|
|
169
171
|
from lightning_sdk.lightning_cloud.openapi.models.metricsstream_create_body import MetricsstreamCreateBody
|
|
170
172
|
from lightning_sdk.lightning_cloud.openapi.models.metricsstream_delete_body import MetricsstreamDeleteBody
|
|
@@ -240,6 +242,8 @@ from lightning_sdk.lightning_cloud.openapi.models.usagerestrictions_id_body impo
|
|
|
240
242
|
from lightning_sdk.lightning_cloud.openapi.models.user_id_affiliatelinks_body import UserIdAffiliatelinksBody
|
|
241
243
|
from lightning_sdk.lightning_cloud.openapi.models.user_id_membershiprolebindings_body import UserIdMembershiprolebindingsBody
|
|
242
244
|
from lightning_sdk.lightning_cloud.openapi.models.user_id_membershiprolebindings_body1 import UserIdMembershiprolebindingsBody1
|
|
245
|
+
from lightning_sdk.lightning_cloud.openapi.models.user_id_upgradetrigger_body import UserIdUpgradetriggerBody
|
|
246
|
+
from lightning_sdk.lightning_cloud.openapi.models.user_user_id_body import UserUserIdBody
|
|
243
247
|
from lightning_sdk.lightning_cloud.openapi.models.v1_aws_cluster_credentials import V1AWSClusterCredentials
|
|
244
248
|
from lightning_sdk.lightning_cloud.openapi.models.v1_aws_direct_v1 import V1AWSDirectV1
|
|
245
249
|
from lightning_sdk.lightning_cloud.openapi.models.v1_aws_direct_v1_status import V1AWSDirectV1Status
|
|
@@ -322,6 +326,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_version import
|
|
|
322
326
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_version_publication import V1CloudSpaceVersionPublication
|
|
323
327
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloudflare_v1 import V1CloudflareV1
|
|
324
328
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloudy_expert import V1CloudyExpert
|
|
329
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_cloudy_settings import V1CloudySettings
|
|
325
330
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_accelerator import V1ClusterAccelerator
|
|
326
331
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_availability import V1ClusterAvailability
|
|
327
332
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_capacity_reservation import V1ClusterCapacityReservation
|
|
@@ -361,6 +366,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_count_metrics_streams_respo
|
|
|
361
366
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_agent_multipart_upload_response import V1CreateAgentMultipartUploadResponse
|
|
362
367
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_billing_portal_session_request import V1CreateBillingPortalSessionRequest
|
|
363
368
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_billing_portal_session_response import V1CreateBillingPortalSessionResponse
|
|
369
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_create_billing_upgrade_trigger_record_response import V1CreateBillingUpgradeTriggerRecordResponse
|
|
364
370
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_blog_post_request import V1CreateBlogPostRequest
|
|
365
371
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_checkout_session_request import V1CreateCheckoutSessionRequest
|
|
366
372
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_checkout_session_response import V1CreateCheckoutSessionResponse
|
|
@@ -529,6 +535,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_filesystem_work import V1Fi
|
|
|
529
535
|
from lightning_sdk.lightning_cloud.openapi.models.v1_find_capacity_block_offering_response import V1FindCapacityBlockOfferingResponse
|
|
530
536
|
from lightning_sdk.lightning_cloud.openapi.models.v1_flowserver import V1Flowserver
|
|
531
537
|
from lightning_sdk.lightning_cloud.openapi.models.v1_folder_index_status import V1FolderIndexStatus
|
|
538
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_function_call import V1FunctionCall
|
|
532
539
|
from lightning_sdk.lightning_cloud.openapi.models.v1_function_tool import V1FunctionTool
|
|
533
540
|
from lightning_sdk.lightning_cloud.openapi.models.v1_gcp_direct_vpc import V1GCPDirectVPC
|
|
534
541
|
from lightning_sdk.lightning_cloud.openapi.models.v1_gcs_folder_data_connection import V1GCSFolderDataConnection
|
|
@@ -543,7 +550,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_affiliate_link_response
|
|
|
543
550
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_env_response import V1GetAgentJobEnvResponse
|
|
544
551
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_logs_metadata_response import V1GetAgentJobLogsMetadataResponse
|
|
545
552
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_artifacts_page_response import V1GetArtifactsPageResponse
|
|
546
|
-
from lightning_sdk.lightning_cloud.openapi.models.
|
|
553
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_get_assistant_session_daily_aggregated_response import V1GetAssistantSessionDailyAggregatedResponse
|
|
547
554
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_cold_start_metrics_stats_response import V1GetCloudSpaceColdStartMetricsStatsResponse
|
|
548
555
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_open_ports_response import V1GetCloudSpaceInstanceOpenPortsResponse
|
|
549
556
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_status_response import V1GetCloudSpaceInstanceStatusResponse
|
|
@@ -551,6 +558,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_sy
|
|
|
551
558
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_size_response import V1GetCloudSpaceSizeResponse
|
|
552
559
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_accelerator_demand_response import V1GetClusterAcceleratorDemandResponse
|
|
553
560
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_credentials_response import V1GetClusterCredentialsResponse
|
|
561
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_health_response import V1GetClusterHealthResponse
|
|
554
562
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_deployment_routing_telemetry_aggregated_response import V1GetDeploymentRoutingTelemetryAggregatedResponse
|
|
555
563
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_deployment_routing_telemetry_content_response import V1GetDeploymentRoutingTelemetryContentResponse
|
|
556
564
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_deployment_routing_telemetry_response import V1GetDeploymentRoutingTelemetryResponse
|
|
@@ -634,6 +642,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_lightningwork_spec import V
|
|
|
634
642
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lightningwork_state import V1LightningworkState
|
|
635
643
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lightningwork_status import V1LightningworkStatus
|
|
636
644
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lightningwork_status_reason import V1LightningworkStatusReason
|
|
645
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_like_status import V1LikeStatus
|
|
637
646
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_affiliate_links_response import V1ListAffiliateLinksResponse
|
|
638
647
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_agent_job_artifacts_response import V1ListAgentJobArtifactsResponse
|
|
639
648
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_agent_jobs_response import V1ListAgentJobsResponse
|
|
@@ -724,6 +733,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_list_project_memberships_re
|
|
|
724
733
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_project_roles_response import V1ListProjectRolesResponse
|
|
725
734
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_published_cloud_spaces_response import V1ListPublishedCloudSpacesResponse
|
|
726
735
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_published_deployment_templates_response import V1ListPublishedDeploymentTemplatesResponse
|
|
736
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_list_published_managed_endpoints_response import V1ListPublishedManagedEndpointsResponse
|
|
727
737
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_quests_response import V1ListQuestsResponse
|
|
728
738
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_slurm_cluster_users_response import V1ListSLURMClusterUsersResponse
|
|
729
739
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_ssh_public_keys_response import V1ListSSHPublicKeysResponse
|
|
@@ -924,6 +934,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_telemetry import V1Telemetr
|
|
|
924
934
|
from lightning_sdk.lightning_cloud.openapi.models.v1_timestamp_code_telemetry import V1TimestampCodeTelemetry
|
|
925
935
|
from lightning_sdk.lightning_cloud.openapi.models.v1_token_usage import V1TokenUsage
|
|
926
936
|
from lightning_sdk.lightning_cloud.openapi.models.v1_tool import V1Tool
|
|
937
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_tool_call import V1ToolCall
|
|
927
938
|
from lightning_sdk.lightning_cloud.openapi.models.v1_transaction import V1Transaction
|
|
928
939
|
from lightning_sdk.lightning_cloud.openapi.models.v1_transfer_cloud_space_response import V1TransferCloudSpaceResponse
|
|
929
940
|
from lightning_sdk.lightning_cloud.openapi.models.v1_transfer_org_balance_response import V1TransferOrgBalanceResponse
|
|
@@ -941,6 +952,8 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_update_cloud_space_visibili
|
|
|
941
952
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_request import V1UpdateClusterAcceleratorsRequest
|
|
942
953
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_response import V1UpdateClusterAcceleratorsResponse
|
|
943
954
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_availability_request import V1UpdateClusterAvailabilityRequest
|
|
955
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_like_response import V1UpdateConversationLikeResponse
|
|
956
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_message_like_response import V1UpdateConversationMessageLikeResponse
|
|
944
957
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_deployment_visibility_response import V1UpdateDeploymentVisibilityResponse
|
|
945
958
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_index_response import V1UpdateIndexResponse
|
|
946
959
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_job_visibility_response import V1UpdateJobVisibilityResponse
|