lightning-sdk 2025.7.17__py3-none-any.whl → 2025.7.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 +3 -2
- lightning_sdk/api/cloud_account_api.py +154 -0
- lightning_sdk/api/deployment_api.py +11 -0
- lightning_sdk/api/job_api.py +9 -0
- lightning_sdk/api/mmt_api.py +9 -0
- lightning_sdk/api/pipeline_api.py +4 -3
- lightning_sdk/api/studio_api.py +19 -5
- lightning_sdk/cli/clusters_menu.py +3 -3
- lightning_sdk/cli/create.py +22 -10
- lightning_sdk/cli/deploy/_auth.py +19 -3
- lightning_sdk/cli/deploy/serve.py +18 -4
- lightning_sdk/cli/entrypoint.py +1 -1
- lightning_sdk/cli/start.py +37 -7
- 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 +15 -1
- lightning_sdk/lightning_cloud/openapi/__init__.py +9 -1
- lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +335 -0
- lightning_sdk/lightning_cloud/openapi/api/billing_service_api.py +153 -48
- lightning_sdk/lightning_cloud/openapi/models/__init__.py +9 -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/project_id_schedules_body.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/schedules_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/user_id_upgradetrigger_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_blog_post.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_conversation.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 +29 -3
- 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_kubernetes_direct_v1.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_like_status.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_published_managed_endpoint_models_response.py +123 -0
- 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_schedule.py +27 -1
- 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 +1 -261
- lightning_sdk/llm/llm.py +29 -5
- lightning_sdk/machine.py +12 -0
- 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 +21 -2
- 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 +79 -39
- lightning_sdk/teamspace.py +14 -8
- lightning_sdk/utils/resolve.py +29 -2
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.22.dist-info}/METADATA +1 -1
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.22.dist-info}/RECORD +67 -59
- 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.22.dist-info}/LICENSE +0 -0
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.22.dist-info}/WHEEL +0 -0
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.22.dist-info}/entry_points.txt +0 -0
- {lightning_sdk-2025.7.17.dist-info → lightning_sdk-2025.7.22.dist-info}/top_level.txt +0 -0
|
@@ -130,6 +130,7 @@ class Deployment:
|
|
|
130
130
|
include_credentials: Optional[bool] = None,
|
|
131
131
|
from_onboarding: Optional[bool] = None,
|
|
132
132
|
from_litserve: Optional[bool] = None,
|
|
133
|
+
max_runtime: Optional[int] = None,
|
|
133
134
|
) -> None:
|
|
134
135
|
"""The Lightning AI Deployment.
|
|
135
136
|
|
|
@@ -157,6 +158,10 @@ class Deployment:
|
|
|
157
158
|
quantity: The number of machines per replica to deploy.
|
|
158
159
|
include_credentials: Whether to include the environment variables for the SDK to authenticate
|
|
159
160
|
from_onboarding: Whether the deployment is from onboarding.
|
|
161
|
+
max_runtime: the duration (in seconds) for which to allocate the machine.
|
|
162
|
+
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
163
|
+
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
164
|
+
Defaults to 3h
|
|
160
165
|
|
|
161
166
|
Note:
|
|
162
167
|
Since a teamspace can either be owned by an org or by a user directly,
|
|
@@ -227,6 +232,7 @@ class Deployment:
|
|
|
227
232
|
quantity=quantity,
|
|
228
233
|
include_credentials=include_credentials if include_credentials is not None else True,
|
|
229
234
|
cloudspace_id=cloudspace_id,
|
|
235
|
+
max_runtime=max_runtime,
|
|
230
236
|
),
|
|
231
237
|
strategy=to_strategy(release_strategy),
|
|
232
238
|
),
|
|
@@ -262,6 +268,7 @@ class Deployment:
|
|
|
262
268
|
cluster: Optional[str] = None, # deprecated in favor of cloud_account
|
|
263
269
|
quantity: Optional[int] = None,
|
|
264
270
|
include_credentials: Optional[bool] = None,
|
|
271
|
+
max_runtime: Optional[int] = None,
|
|
265
272
|
) -> None:
|
|
266
273
|
cloud_account = _resolve_deprecated_cluster(cloud_account, cluster)
|
|
267
274
|
|
|
@@ -288,6 +295,7 @@ class Deployment:
|
|
|
288
295
|
release_strategy=release_strategy,
|
|
289
296
|
quantity=quantity,
|
|
290
297
|
include_credentials=include_credentials,
|
|
298
|
+
max_runtime=max_runtime,
|
|
291
299
|
)
|
|
292
300
|
|
|
293
301
|
def stop(self) -> None:
|
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
|
@@ -6,7 +6,7 @@ from lightning_sdk.job.base import _BaseJob
|
|
|
6
6
|
from lightning_sdk.status import Status
|
|
7
7
|
|
|
8
8
|
if TYPE_CHECKING:
|
|
9
|
-
from lightning_sdk.machine import Machine
|
|
9
|
+
from lightning_sdk.machine import CloudProvider, Machine
|
|
10
10
|
from lightning_sdk.organization import Organization
|
|
11
11
|
from lightning_sdk.studio import Studio
|
|
12
12
|
from lightning_sdk.teamspace import Teamspace
|
|
@@ -44,10 +44,12 @@ class _JobV2(_BaseJob):
|
|
|
44
44
|
env: Optional[Dict[str, str]] = None,
|
|
45
45
|
interruptible: bool = False,
|
|
46
46
|
cloud_account: Optional[str] = None,
|
|
47
|
+
cloud_provider: Optional[Union["CloudProvider", str]] = None,
|
|
47
48
|
image_credentials: Optional[str] = None,
|
|
48
49
|
cloud_account_auth: bool = False,
|
|
49
50
|
entrypoint: str = "sh -c",
|
|
50
51
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
52
|
+
max_runtime: Optional[int] = None,
|
|
51
53
|
artifacts_local: Optional[str] = None, # deprecated in favor of path_mappings
|
|
52
54
|
artifacts_remote: Optional[str] = None, # deprecated in favor of path_mappings
|
|
53
55
|
) -> "_JobV2":
|
|
@@ -80,6 +82,10 @@ class _JobV2(_BaseJob):
|
|
|
80
82
|
}
|
|
81
83
|
If the path inside the connection is omitted it's assumed to be the root path of that connection.
|
|
82
84
|
Only applicable when submitting docker jobs.
|
|
85
|
+
max_runtime: the duration (in seconds) for which to allocate the machine.
|
|
86
|
+
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
87
|
+
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
88
|
+
Defaults to 3h
|
|
83
89
|
"""
|
|
84
90
|
# Command is required if Studio is provided to know what to run
|
|
85
91
|
# Image is mutually exclusive with Studio
|
|
@@ -98,6 +104,13 @@ class _JobV2(_BaseJob):
|
|
|
98
104
|
if image is None:
|
|
99
105
|
raise ValueError("either image or studio must be provided")
|
|
100
106
|
|
|
107
|
+
cloud_account = self._cloud_account_api.resolve_cloud_account(
|
|
108
|
+
self._teamspace.id,
|
|
109
|
+
cloud_account=cloud_account,
|
|
110
|
+
cloud_provider=cloud_provider,
|
|
111
|
+
default_cloud_account=self._teamspace.default_cloud_account,
|
|
112
|
+
)
|
|
113
|
+
|
|
101
114
|
submitted = self._job_api.submit_job(
|
|
102
115
|
name=self.name,
|
|
103
116
|
command=command,
|
|
@@ -114,6 +127,7 @@ class _JobV2(_BaseJob):
|
|
|
114
127
|
artifacts_remote=artifacts_remote,
|
|
115
128
|
entrypoint=entrypoint,
|
|
116
129
|
path_mappings=path_mappings,
|
|
130
|
+
max_runtime=max_runtime,
|
|
117
131
|
)
|
|
118
132
|
self._job = submitted
|
|
119
133
|
self._name = submitted.name
|
|
@@ -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,7 @@ 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
|
|
243
246
|
from lightning_sdk.lightning_cloud.openapi.models.v1_aws_cluster_credentials import V1AWSClusterCredentials
|
|
244
247
|
from lightning_sdk.lightning_cloud.openapi.models.v1_aws_direct_v1 import V1AWSDirectV1
|
|
245
248
|
from lightning_sdk.lightning_cloud.openapi.models.v1_aws_direct_v1_status import V1AWSDirectV1Status
|
|
@@ -361,6 +364,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_count_metrics_streams_respo
|
|
|
361
364
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_agent_multipart_upload_response import V1CreateAgentMultipartUploadResponse
|
|
362
365
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_billing_portal_session_request import V1CreateBillingPortalSessionRequest
|
|
363
366
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_billing_portal_session_response import V1CreateBillingPortalSessionResponse
|
|
367
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_create_billing_upgrade_trigger_record_response import V1CreateBillingUpgradeTriggerRecordResponse
|
|
364
368
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_blog_post_request import V1CreateBlogPostRequest
|
|
365
369
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_checkout_session_request import V1CreateCheckoutSessionRequest
|
|
366
370
|
from lightning_sdk.lightning_cloud.openapi.models.v1_create_checkout_session_response import V1CreateCheckoutSessionResponse
|
|
@@ -543,7 +547,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_affiliate_link_response
|
|
|
543
547
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_env_response import V1GetAgentJobEnvResponse
|
|
544
548
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_logs_metadata_response import V1GetAgentJobLogsMetadataResponse
|
|
545
549
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_artifacts_page_response import V1GetArtifactsPageResponse
|
|
546
|
-
from lightning_sdk.lightning_cloud.openapi.models.
|
|
550
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_get_assistant_session_daily_aggregated_response import V1GetAssistantSessionDailyAggregatedResponse
|
|
547
551
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_cold_start_metrics_stats_response import V1GetCloudSpaceColdStartMetricsStatsResponse
|
|
548
552
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_open_ports_response import V1GetCloudSpaceInstanceOpenPortsResponse
|
|
549
553
|
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_status_response import V1GetCloudSpaceInstanceStatusResponse
|
|
@@ -634,6 +638,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_lightningwork_spec import V
|
|
|
634
638
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lightningwork_state import V1LightningworkState
|
|
635
639
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lightningwork_status import V1LightningworkStatus
|
|
636
640
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lightningwork_status_reason import V1LightningworkStatusReason
|
|
641
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_like_status import V1LikeStatus
|
|
637
642
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_affiliate_links_response import V1ListAffiliateLinksResponse
|
|
638
643
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_agent_job_artifacts_response import V1ListAgentJobArtifactsResponse
|
|
639
644
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_agent_jobs_response import V1ListAgentJobsResponse
|
|
@@ -724,6 +729,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_list_project_memberships_re
|
|
|
724
729
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_project_roles_response import V1ListProjectRolesResponse
|
|
725
730
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_published_cloud_spaces_response import V1ListPublishedCloudSpacesResponse
|
|
726
731
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_published_deployment_templates_response import V1ListPublishedDeploymentTemplatesResponse
|
|
732
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_list_published_managed_endpoint_models_response import V1ListPublishedManagedEndpointModelsResponse
|
|
727
733
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_quests_response import V1ListQuestsResponse
|
|
728
734
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_slurm_cluster_users_response import V1ListSLURMClusterUsersResponse
|
|
729
735
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_ssh_public_keys_response import V1ListSSHPublicKeysResponse
|
|
@@ -941,6 +947,8 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_update_cloud_space_visibili
|
|
|
941
947
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_request import V1UpdateClusterAcceleratorsRequest
|
|
942
948
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_response import V1UpdateClusterAcceleratorsResponse
|
|
943
949
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_availability_request import V1UpdateClusterAvailabilityRequest
|
|
950
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_like_response import V1UpdateConversationLikeResponse
|
|
951
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_message_like_response import V1UpdateConversationMessageLikeResponse
|
|
944
952
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_deployment_visibility_response import V1UpdateDeploymentVisibilityResponse
|
|
945
953
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_index_response import V1UpdateIndexResponse
|
|
946
954
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_job_visibility_response import V1UpdateJobVisibilityResponse
|