lightning-sdk 2025.8.6rc2__py3-none-any.whl → 2025.11.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. lightning_sdk/__init__.py +13 -7
  2. lightning_sdk/__version__.py +3 -0
  3. lightning_sdk/agents.py +2 -1
  4. lightning_sdk/ai_hub.py +2 -1
  5. lightning_sdk/api/__init__.py +2 -0
  6. lightning_sdk/api/base_studio_api.py +13 -9
  7. lightning_sdk/api/cloud_account_api.py +31 -10
  8. lightning_sdk/api/deployment_api.py +27 -1
  9. lightning_sdk/api/job_api.py +16 -12
  10. lightning_sdk/api/license_api.py +26 -59
  11. lightning_sdk/api/llm_api.py +25 -2
  12. lightning_sdk/api/mmt_api.py +5 -2
  13. lightning_sdk/api/studio_api.py +252 -55
  14. lightning_sdk/api/teamspace_api.py +106 -30
  15. lightning_sdk/api/user_api.py +56 -2
  16. lightning_sdk/api/utils.py +108 -18
  17. lightning_sdk/base_studio.py +51 -27
  18. lightning_sdk/cli/__init__.py +1 -0
  19. lightning_sdk/cli/base_studio/__init__.py +10 -0
  20. lightning_sdk/cli/base_studio/list.py +43 -0
  21. lightning_sdk/cli/config/__init__.py +14 -0
  22. lightning_sdk/cli/config/get.py +57 -0
  23. lightning_sdk/cli/config/set.py +92 -0
  24. lightning_sdk/cli/config/show.py +9 -0
  25. lightning_sdk/cli/entrypoint.py +71 -71
  26. lightning_sdk/cli/groups.py +56 -0
  27. lightning_sdk/cli/job/__init__.py +7 -0
  28. lightning_sdk/cli/{clusters_menu.py → legacy/clusters_menu.py} +9 -6
  29. lightning_sdk/cli/{configure.py → legacy/configure.py} +2 -2
  30. lightning_sdk/cli/{connect.py → legacy/connect.py} +2 -2
  31. lightning_sdk/cli/{create.py → legacy/create.py} +12 -14
  32. lightning_sdk/cli/{delete.py → legacy/delete.py} +5 -5
  33. lightning_sdk/cli/legacy/deploy/__init__.py +0 -0
  34. lightning_sdk/cli/{deploy → legacy/deploy}/_auth.py +5 -6
  35. lightning_sdk/cli/{deploy → legacy/deploy}/devbox.py +8 -2
  36. lightning_sdk/cli/{deploy → legacy/deploy}/serve.py +19 -8
  37. lightning_sdk/cli/{download.py → legacy/download.py} +14 -15
  38. lightning_sdk/cli/legacy/entrypoint.py +110 -0
  39. lightning_sdk/cli/{generate.py → legacy/generate.py} +1 -1
  40. lightning_sdk/cli/{inspection.py → legacy/inspection.py} +1 -1
  41. lightning_sdk/cli/{job_and_mmt_action.py → legacy/job_and_mmt_action.py} +6 -6
  42. lightning_sdk/cli/{jobs_menu.py → legacy/jobs_menu.py} +1 -1
  43. lightning_sdk/cli/{list.py → legacy/list.py} +12 -13
  44. lightning_sdk/cli/{mmts_menu.py → legacy/mmts_menu.py} +1 -1
  45. lightning_sdk/cli/{open.py → legacy/open.py} +4 -4
  46. lightning_sdk/cli/{start.py → legacy/start.py} +1 -0
  47. lightning_sdk/cli/{stop.py → legacy/stop.py} +1 -1
  48. lightning_sdk/cli/{switch.py → legacy/switch.py} +1 -0
  49. lightning_sdk/cli/{teamspace_menu.py → legacy/teamspace_menu.py} +1 -1
  50. lightning_sdk/cli/{upload.py → legacy/upload.py} +7 -8
  51. lightning_sdk/cli/license/__init__.py +14 -0
  52. lightning_sdk/cli/license/get.py +15 -0
  53. lightning_sdk/cli/license/list.py +45 -0
  54. lightning_sdk/cli/license/set.py +13 -0
  55. lightning_sdk/cli/mmt/__init__.py +7 -0
  56. lightning_sdk/cli/studio/__init__.py +24 -0
  57. lightning_sdk/cli/studio/connect.py +139 -0
  58. lightning_sdk/cli/studio/create.py +96 -0
  59. lightning_sdk/cli/studio/delete.py +49 -0
  60. lightning_sdk/cli/studio/list.py +85 -0
  61. lightning_sdk/cli/studio/ssh.py +64 -0
  62. lightning_sdk/cli/studio/start.py +115 -0
  63. lightning_sdk/cli/studio/stop.py +45 -0
  64. lightning_sdk/cli/studio/switch.py +66 -0
  65. lightning_sdk/cli/utils/__init__.py +7 -0
  66. lightning_sdk/cli/utils/cloud_account_map.py +10 -0
  67. lightning_sdk/cli/utils/get_base_studio.py +24 -0
  68. lightning_sdk/cli/utils/handle_machine_and_gpus_args.py +69 -0
  69. lightning_sdk/cli/utils/logging.py +122 -0
  70. lightning_sdk/cli/utils/owner_selection.py +110 -0
  71. lightning_sdk/cli/utils/resolve.py +28 -0
  72. lightning_sdk/cli/utils/richt_print.py +35 -0
  73. lightning_sdk/cli/utils/save_to_config.py +27 -0
  74. lightning_sdk/cli/utils/ssh_connection.py +59 -0
  75. lightning_sdk/cli/utils/studio_selection.py +113 -0
  76. lightning_sdk/cli/utils/teamspace_selection.py +125 -0
  77. lightning_sdk/cli/vm/__init__.py +20 -0
  78. lightning_sdk/cli/vm/create.py +33 -0
  79. lightning_sdk/cli/vm/delete.py +25 -0
  80. lightning_sdk/cli/vm/list.py +30 -0
  81. lightning_sdk/cli/vm/ssh.py +31 -0
  82. lightning_sdk/cli/vm/start.py +60 -0
  83. lightning_sdk/cli/vm/stop.py +25 -0
  84. lightning_sdk/cli/vm/switch.py +38 -0
  85. lightning_sdk/constants.py +1 -0
  86. lightning_sdk/deployment/__init__.py +2 -0
  87. lightning_sdk/deployment/deployment.py +17 -2
  88. lightning_sdk/helpers.py +56 -37
  89. lightning_sdk/job/base.py +21 -6
  90. lightning_sdk/job/job.py +13 -0
  91. lightning_sdk/job/v1.py +11 -0
  92. lightning_sdk/job/v2.py +12 -0
  93. lightning_sdk/lightning_cloud/login.py +320 -10
  94. lightning_sdk/lightning_cloud/openapi/__init__.py +113 -3
  95. lightning_sdk/lightning_cloud/openapi/api/__init__.py +3 -0
  96. lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +713 -75
  97. lightning_sdk/lightning_cloud/openapi/api/auth_service_api.py +376 -0
  98. lightning_sdk/lightning_cloud/openapi/api/billing_service_api.py +191 -1
  99. lightning_sdk/lightning_cloud/openapi/api/cloud_space_environment_template_service_api.py +5 -1
  100. lightning_sdk/lightning_cloud/openapi/api/cloud_space_service_api.py +420 -0
  101. lightning_sdk/lightning_cloud/openapi/api/cloudy_service_api.py +0 -97
  102. lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +420 -0
  103. lightning_sdk/lightning_cloud/openapi/api/data_connection_service_api.py +101 -0
  104. lightning_sdk/lightning_cloud/openapi/api/incidents_service_api.py +1058 -0
  105. lightning_sdk/lightning_cloud/openapi/api/jobs_service_api.py +121 -0
  106. lightning_sdk/lightning_cloud/openapi/api/k8_s_cluster_service_api.py +1742 -94
  107. lightning_sdk/lightning_cloud/openapi/api/markets_service_api.py +145 -0
  108. lightning_sdk/lightning_cloud/openapi/api/models_store_api.py +4 -4
  109. lightning_sdk/lightning_cloud/openapi/api/product_license_service_api.py +108 -108
  110. lightning_sdk/lightning_cloud/openapi/api/projects_service_api.py +105 -0
  111. lightning_sdk/lightning_cloud/openapi/api/schedules_service_api.py +347 -0
  112. lightning_sdk/lightning_cloud/openapi/api/sdk_command_history_service_api.py +141 -0
  113. lightning_sdk/lightning_cloud/openapi/api/storage_service_api.py +761 -1
  114. lightning_sdk/lightning_cloud/openapi/configuration.py +3 -19
  115. lightning_sdk/lightning_cloud/openapi/models/__init__.py +110 -3
  116. lightning_sdk/lightning_cloud/openapi/models/assistant_id_conversations_body.py +15 -15
  117. lightning_sdk/lightning_cloud/openapi/models/cloudspace_id_visibility_body.py +27 -1
  118. lightning_sdk/lightning_cloud/openapi/models/cluster_id_kubernetestemplates_body.py +201 -0
  119. lightning_sdk/lightning_cloud/openapi/models/cluster_id_metrics_body.py +131 -1
  120. lightning_sdk/lightning_cloud/openapi/models/create.py +27 -1
  121. lightning_sdk/lightning_cloud/openapi/models/create_machine_request_represents_the_request_to_create_a_machine.py +461 -0
  122. lightning_sdk/lightning_cloud/openapi/models/deployments_id_body.py +27 -1
  123. lightning_sdk/lightning_cloud/openapi/models/externalv1_cloud_space_instance_status.py +105 -1
  124. lightning_sdk/lightning_cloud/openapi/models/externalv1_user_status.py +27 -1
  125. lightning_sdk/lightning_cloud/openapi/models/id_codeconfig_body.py +3 -81
  126. lightning_sdk/lightning_cloud/openapi/models/id_fork_body1.py +27 -1
  127. lightning_sdk/lightning_cloud/openapi/models/id_render_body.py +123 -0
  128. lightning_sdk/lightning_cloud/openapi/models/id_sleepconfig_body.py +175 -0
  129. lightning_sdk/lightning_cloud/openapi/models/id_transfer_body.py +53 -1
  130. lightning_sdk/lightning_cloud/openapi/models/incident_id_messages_body.py +123 -0
  131. lightning_sdk/lightning_cloud/openapi/models/incidents_id_body.py +279 -0
  132. lightning_sdk/lightning_cloud/openapi/models/job_id_reportroutingtelemetry_body.py +123 -0
  133. lightning_sdk/lightning_cloud/openapi/models/kubernetestemplates_id_body.py +201 -0
  134. lightning_sdk/lightning_cloud/openapi/models/license_key_validate_body.py +123 -0
  135. lightning_sdk/lightning_cloud/openapi/models/message_id_actions_body.py +201 -0
  136. lightning_sdk/lightning_cloud/openapi/models/messages_message_id_body.py +123 -0
  137. lightning_sdk/lightning_cloud/openapi/models/metricsstream_create_body.py +27 -1
  138. lightning_sdk/lightning_cloud/openapi/models/models_model_id_body.py +109 -31
  139. lightning_sdk/lightning_cloud/openapi/models/models_model_id_body1.py +149 -0
  140. lightning_sdk/lightning_cloud/openapi/models/orgs_id_body.py +53 -1
  141. lightning_sdk/lightning_cloud/openapi/models/project_id_storage_body.py +27 -1
  142. lightning_sdk/lightning_cloud/openapi/models/project_id_storagetransfers_body.py +175 -0
  143. lightning_sdk/lightning_cloud/openapi/models/project_tab_management_messages.py +123 -0
  144. lightning_sdk/lightning_cloud/openapi/models/projects_id_body.py +79 -1
  145. lightning_sdk/lightning_cloud/openapi/models/storage_complete_body.py +41 -15
  146. lightning_sdk/lightning_cloud/openapi/models/storagetransfers_validate_body.py +149 -0
  147. lightning_sdk/lightning_cloud/openapi/models/update1.py +27 -1
  148. lightning_sdk/lightning_cloud/openapi/models/uploads_upload_id_body1.py +27 -1
  149. lightning_sdk/lightning_cloud/openapi/models/user_id_affiliatelinks_body.py +107 -3
  150. lightning_sdk/lightning_cloud/openapi/models/v1_abort_storage_transfer_response.py +97 -0
  151. lightning_sdk/lightning_cloud/openapi/models/v1_aggregated_pod_metrics.py +799 -0
  152. lightning_sdk/lightning_cloud/openapi/models/v1_ai_pod_v1.py +53 -1
  153. lightning_sdk/lightning_cloud/openapi/models/v1_assistant_session_daily_aggregated.py +27 -1
  154. lightning_sdk/lightning_cloud/openapi/models/v1_billing_tier.py +0 -1
  155. lightning_sdk/lightning_cloud/openapi/models/v1_cancel_running_cloud_space_instance_transfer_response.py +97 -0
  156. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_provider.py +2 -0
  157. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template_config.py +27 -1
  158. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_specialized_view.py +1 -0
  159. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_transfer_metadata.py +147 -17
  160. lightning_sdk/lightning_cloud/openapi/models/v1_cloudflare_v1.py +3 -29
  161. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_accelerator.py +53 -1
  162. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_capacity_reservation.py +27 -1
  163. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_metrics.py +1527 -0
  164. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_security_options.py +27 -1
  165. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_spec.py +53 -1
  166. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_type.py +1 -0
  167. lightning_sdk/lightning_cloud/openapi/models/v1_container_metrics.py +21 -21
  168. lightning_sdk/lightning_cloud/openapi/models/v1_create_incident_request.py +305 -0
  169. lightning_sdk/lightning_cloud/openapi/models/v1_create_license_request.py +175 -0
  170. lightning_sdk/lightning_cloud/openapi/models/v1_create_machine_response.py +123 -0
  171. lightning_sdk/lightning_cloud/openapi/models/v1_create_model_metrics_response.py +97 -0
  172. lightning_sdk/lightning_cloud/openapi/models/v1_create_project_request.py +79 -1
  173. lightning_sdk/lightning_cloud/openapi/models/v1_create_sdk_command_history_request.py +253 -0
  174. lightning_sdk/lightning_cloud/openapi/models/v1_create_sdk_command_history_response.py +97 -0
  175. lightning_sdk/lightning_cloud/openapi/models/v1_daily_model_metrics.py +149 -0
  176. lightning_sdk/lightning_cloud/openapi/models/v1_data_connection.py +53 -1
  177. lightning_sdk/lightning_cloud/openapi/models/v1_delete_incident_message_response.py +97 -0
  178. lightning_sdk/lightning_cloud/openapi/models/v1_delete_incident_response.py +97 -0
  179. lightning_sdk/lightning_cloud/openapi/models/v1_delete_kubernetes_template_response.py +97 -0
  180. lightning_sdk/lightning_cloud/openapi/models/v1_delete_license_response.py +97 -0
  181. lightning_sdk/lightning_cloud/openapi/models/v1_delete_machine_response.py +97 -0
  182. lightning_sdk/lightning_cloud/openapi/models/v1_deployment.py +27 -1
  183. lightning_sdk/lightning_cloud/openapi/models/v1_external_cluster_spec.py +53 -1
  184. lightning_sdk/lightning_cloud/openapi/models/v1_external_search_user.py +27 -1
  185. lightning_sdk/lightning_cloud/openapi/models/v1_filestore_data_connection.py +27 -1
  186. lightning_sdk/lightning_cloud/openapi/models/v1_filesystem_metric.py +201 -0
  187. lightning_sdk/lightning_cloud/openapi/models/v1_firewall_rule.py +175 -0
  188. lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_required_balance_status_response.py +149 -0
  189. lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_transfer_estimate_response.py +149 -0
  190. lightning_sdk/lightning_cloud/openapi/models/v1_get_latest_model_metrics_response.py +123 -0
  191. lightning_sdk/lightning_cloud/openapi/models/v1_get_machine_response.py +123 -0
  192. lightning_sdk/lightning_cloud/openapi/models/v1_get_market_pricing_response.py +201 -0
  193. lightning_sdk/lightning_cloud/openapi/models/v1_get_model_metrics_response.py +123 -0
  194. lightning_sdk/lightning_cloud/openapi/models/v1_get_temp_bucket_credentials_response.py +201 -0
  195. lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +41 -15
  196. lightning_sdk/lightning_cloud/openapi/models/v1_google_cloud_direct_v1.py +27 -1
  197. lightning_sdk/lightning_cloud/openapi/models/v1_group_node_metrics.py +1215 -0
  198. lightning_sdk/lightning_cloud/openapi/models/v1_group_pod_metrics.py +1241 -0
  199. lightning_sdk/lightning_cloud/openapi/models/v1_guest_login_request.py +177 -0
  200. lightning_sdk/lightning_cloud/openapi/models/v1_guest_login_response.py +149 -0
  201. lightning_sdk/lightning_cloud/openapi/models/v1_guest_user.py +201 -0
  202. lightning_sdk/lightning_cloud/openapi/models/v1_incident.py +565 -0
  203. lightning_sdk/lightning_cloud/openapi/models/v1_incident_detail.py +149 -0
  204. lightning_sdk/lightning_cloud/openapi/models/v1_incident_event.py +591 -0
  205. lightning_sdk/lightning_cloud/openapi/models/v1_incident_message.py +253 -0
  206. lightning_sdk/lightning_cloud/openapi/models/v1_incident_severity.py +105 -0
  207. lightning_sdk/lightning_cloud/openapi/models/v1_incident_type.py +108 -0
  208. lightning_sdk/lightning_cloud/openapi/models/v1_job.py +53 -1
  209. lightning_sdk/lightning_cloud/openapi/models/v1_job_spec.py +27 -1
  210. lightning_sdk/lightning_cloud/openapi/models/v1_k8s_incident_indexes.py +149 -0
  211. lightning_sdk/lightning_cloud/openapi/models/v1_kai_scheduler_queue_metrics.py +627 -0
  212. lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_aws_config.py +279 -0
  213. lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_settings_v1.py +253 -0
  214. lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_v1.py +107 -3
  215. lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_template.py +357 -0
  216. lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_template_property.py +227 -0
  217. lightning_sdk/lightning_cloud/openapi/models/v1_lambda_labs_direct_v1.py +29 -3
  218. lightning_sdk/lightning_cloud/openapi/models/v1_license.py +227 -0
  219. lightning_sdk/lightning_cloud/openapi/models/v1_lightning_elastic_cluster_v1.py +97 -0
  220. lightning_sdk/lightning_cloud/openapi/models/v1_list_aggregated_pod_metrics_response.py +123 -0
  221. lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_metric_timestamps_response.py +123 -0
  222. lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_metrics_response.py +123 -0
  223. lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_namespace_metrics_response.py +123 -0
  224. lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_namespace_user_metrics_response.py +123 -0
  225. lightning_sdk/lightning_cloud/openapi/models/v1_list_conversation_message_actions_response.py +123 -0
  226. lightning_sdk/lightning_cloud/openapi/models/v1_list_filesystem_metrics_response.py +123 -0
  227. lightning_sdk/lightning_cloud/openapi/models/v1_list_group_pod_metrics_response.py +123 -0
  228. lightning_sdk/lightning_cloud/openapi/models/v1_list_incident_events_response.py +123 -0
  229. lightning_sdk/lightning_cloud/openapi/models/v1_list_incident_messages_response.py +149 -0
  230. lightning_sdk/lightning_cloud/openapi/models/v1_list_incidents_response.py +149 -0
  231. lightning_sdk/lightning_cloud/openapi/models/v1_list_kai_scheduler_queues_metrics_response.py +123 -0
  232. lightning_sdk/lightning_cloud/openapi/models/v1_list_kubernetes_templates_response.py +123 -0
  233. lightning_sdk/lightning_cloud/openapi/models/{v1_list_product_licenses_response.py → v1_list_license_response.py} +16 -16
  234. lightning_sdk/lightning_cloud/openapi/models/v1_list_machines_response.py +149 -0
  235. lightning_sdk/lightning_cloud/openapi/models/v1_list_platform_notifications_response.py +123 -0
  236. lightning_sdk/lightning_cloud/openapi/models/v1_list_schedule_runs_response.py +123 -0
  237. lightning_sdk/lightning_cloud/openapi/models/v1_list_storage_transfers_response.py +123 -0
  238. lightning_sdk/lightning_cloud/openapi/models/v1_lustre_data_connection.py +149 -0
  239. lightning_sdk/lightning_cloud/openapi/models/v1_machine.py +617 -0
  240. lightning_sdk/lightning_cloud/openapi/models/v1_machine_direct_v1.py +123 -0
  241. lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_request.py +1 -27
  242. lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_response.py +27 -1
  243. lightning_sdk/lightning_cloud/openapi/models/v1_managed_model.py +29 -3
  244. lightning_sdk/lightning_cloud/openapi/models/v1_market_price.py +149 -0
  245. lightning_sdk/lightning_cloud/openapi/models/v1_membership.py +53 -1
  246. lightning_sdk/lightning_cloud/openapi/models/v1_message_action.py +279 -0
  247. lightning_sdk/lightning_cloud/openapi/models/v1_metrics_stream.py +27 -1
  248. lightning_sdk/lightning_cloud/openapi/models/v1_model_metrics.py +175 -0
  249. lightning_sdk/lightning_cloud/openapi/models/v1_namespace_metrics.py +591 -0
  250. lightning_sdk/lightning_cloud/openapi/models/v1_namespace_user_metrics.py +435 -0
  251. lightning_sdk/lightning_cloud/openapi/models/v1_nebius_direct_v1.py +29 -3
  252. lightning_sdk/lightning_cloud/openapi/models/v1_node_metrics.py +361 -23
  253. lightning_sdk/lightning_cloud/openapi/models/v1_notification_type.py +1 -0
  254. lightning_sdk/lightning_cloud/openapi/models/v1_organization.py +53 -1
  255. lightning_sdk/lightning_cloud/openapi/models/v1_pause_storage_transfer_response.py +97 -0
  256. lightning_sdk/lightning_cloud/openapi/models/v1_platform_notification.py +279 -0
  257. lightning_sdk/lightning_cloud/openapi/models/v1_pod_metrics.py +335 -23
  258. lightning_sdk/lightning_cloud/openapi/models/v1_project.py +27 -1
  259. lightning_sdk/lightning_cloud/openapi/models/v1_project_cluster_binding.py +27 -1
  260. lightning_sdk/lightning_cloud/openapi/models/v1_project_membership.py +53 -1
  261. lightning_sdk/lightning_cloud/openapi/models/v1_project_settings.py +53 -1
  262. lightning_sdk/lightning_cloud/openapi/models/v1_project_tab.py +149 -0
  263. lightning_sdk/lightning_cloud/openapi/models/{v1_product_license_check_response.py → v1_purchase_annual_upsell_request.py} +23 -23
  264. lightning_sdk/lightning_cloud/openapi/models/v1_purchase_annual_upsell_response.py +123 -0
  265. lightning_sdk/lightning_cloud/openapi/models/v1_quote_annual_upsell_response.py +227 -0
  266. lightning_sdk/lightning_cloud/openapi/models/v1_render_kubernetes_template_response.py +123 -0
  267. lightning_sdk/lightning_cloud/openapi/models/v1_report_deployment_routing_telemetry_response.py +97 -0
  268. lightning_sdk/lightning_cloud/openapi/models/v1_required_balance_reason.py +107 -0
  269. lightning_sdk/lightning_cloud/openapi/models/v1_reset_api_key_request.py +97 -0
  270. lightning_sdk/lightning_cloud/openapi/models/v1_reset_api_key_response.py +123 -0
  271. lightning_sdk/lightning_cloud/openapi/models/v1_resource_visibility.py +1 -27
  272. lightning_sdk/lightning_cloud/openapi/models/v1_resume_storage_transfer_response.py +97 -0
  273. lightning_sdk/lightning_cloud/openapi/models/v1_routing_telemetry.py +79 -1
  274. lightning_sdk/lightning_cloud/openapi/models/v1_rule_resource.py +1 -0
  275. lightning_sdk/lightning_cloud/openapi/models/v1_schedule_run.py +357 -0
  276. lightning_sdk/lightning_cloud/openapi/models/v1_sdk_command_history_severity.py +104 -0
  277. lightning_sdk/lightning_cloud/openapi/models/v1_sdk_command_history_type.py +104 -0
  278. lightning_sdk/lightning_cloud/openapi/models/v1_secret_type.py +1 -0
  279. lightning_sdk/lightning_cloud/openapi/models/v1_server_alert_type.py +1 -0
  280. lightning_sdk/lightning_cloud/openapi/models/v1_slack_notifier.py +201 -0
  281. lightning_sdk/lightning_cloud/openapi/models/v1_slack_notifier_type.py +105 -0
  282. lightning_sdk/lightning_cloud/openapi/models/v1_storage_asset.py +133 -3
  283. lightning_sdk/lightning_cloud/openapi/models/v1_storage_transfer.py +435 -0
  284. lightning_sdk/lightning_cloud/openapi/models/v1_storage_transfer_status.py +108 -0
  285. lightning_sdk/lightning_cloud/openapi/models/v1_token_login_request.py +123 -0
  286. lightning_sdk/lightning_cloud/openapi/models/v1_token_login_response.py +123 -0
  287. lightning_sdk/lightning_cloud/openapi/models/v1_token_owner_type.py +104 -0
  288. lightning_sdk/lightning_cloud/openapi/models/v1_update_cloud_space_instance_config_request.py +3 -81
  289. lightning_sdk/lightning_cloud/openapi/models/v1_update_project_tab_order_response.py +123 -0
  290. lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +41 -15
  291. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +444 -600
  292. lightning_sdk/lightning_cloud/openapi/models/v1_validate_license_response.py +123 -0
  293. lightning_sdk/lightning_cloud/openapi/models/v1_validate_storage_transfer_response.py +123 -0
  294. lightning_sdk/lightning_cloud/openapi/models/v1_voltage_park_direct_v1.py +29 -3
  295. lightning_sdk/lightning_cloud/rest_client.py +48 -45
  296. lightning_sdk/lightning_cloud/utils/data_connection.py +51 -1
  297. lightning_sdk/llm/llm.py +175 -56
  298. lightning_sdk/llm/public_assistants.py +44 -7
  299. lightning_sdk/machine.py +21 -2
  300. lightning_sdk/mmt/base.py +7 -0
  301. lightning_sdk/mmt/mmt.py +11 -3
  302. lightning_sdk/mmt/v1.py +3 -1
  303. lightning_sdk/mmt/v2.py +4 -0
  304. lightning_sdk/owner.py +2 -1
  305. lightning_sdk/pipeline/steps.py +6 -0
  306. lightning_sdk/plugin.py +6 -1
  307. lightning_sdk/studio.py +294 -53
  308. lightning_sdk/teamspace.py +167 -7
  309. lightning_sdk/user.py +19 -1
  310. lightning_sdk/utils/config.py +179 -0
  311. lightning_sdk/utils/license.py +13 -0
  312. lightning_sdk/utils/logging.py +79 -0
  313. lightning_sdk/utils/names.py +1179 -0
  314. lightning_sdk/utils/progress.py +283 -0
  315. lightning_sdk/utils/resolve.py +82 -7
  316. {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/METADATA +2 -1
  317. {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/RECORD +328 -169
  318. {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/entry_points.txt +1 -0
  319. lightning_sdk/lightning_cloud/openapi/models/v1_product_license.py +0 -435
  320. lightning_sdk/services/license.py +0 -363
  321. /lightning_sdk/cli/{deploy → legacy}/__init__.py +0 -0
  322. /lightning_sdk/cli/{ai_hub.py → legacy/ai_hub.py} +0 -0
  323. /lightning_sdk/cli/{docker_cli.py → legacy/docker_cli.py} +0 -0
  324. /lightning_sdk/cli/{exceptions.py → legacy/exceptions.py} +0 -0
  325. /lightning_sdk/cli/{run.py → legacy/run.py} +0 -0
  326. /lightning_sdk/cli/{studios_menu.py → legacy/studios_menu.py} +0 -0
  327. /lightning_sdk/cli/{coloring.py → utils/coloring.py} +0 -0
  328. {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/LICENSE +0 -0
  329. {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/WHEEL +0 -0
  330. {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,25 @@
1
+ from typing import Optional
2
+
3
+ import click
4
+
5
+ from lightning_sdk.cli.studio.delete import delete_impl
6
+
7
+
8
+ @click.command("delete")
9
+ @click.option(
10
+ "--name",
11
+ help=(
12
+ "The name of the VM to delete. "
13
+ "If not provided, will try to infer from environment, "
14
+ "use the default value from the config or prompt for interactive selection."
15
+ ),
16
+ )
17
+ @click.option("--teamspace", help="Override default teamspace (format: owner/teamspace)")
18
+ def delete_vm(name: Optional[str] = None, teamspace: Optional[str] = None) -> None:
19
+ """Delete a VM.
20
+
21
+ Example:
22
+ lightning vm delete --name my-vm
23
+
24
+ """
25
+ return delete_impl(name=name, teamspace=teamspace, vm=True)
@@ -0,0 +1,30 @@
1
+ from typing import Optional
2
+
3
+ import click
4
+
5
+ from lightning_sdk.cli.studio.list import list_impl
6
+
7
+
8
+ @click.command("list")
9
+ @click.option("--teamspace", help="Override default teamspace (format: owner/teamspace)")
10
+ @click.option(
11
+ "--all",
12
+ is_flag=True,
13
+ flag_value=True,
14
+ default=False,
15
+ help="List all VMs, not just the ones belonging to the authed user",
16
+ )
17
+ @click.option(
18
+ "--sort-by",
19
+ default=None,
20
+ type=click.Choice(["name", "teamspace", "status", "machine", "cloud-account"], case_sensitive=False),
21
+ help="the attribute to sort the VMs by.",
22
+ )
23
+ def list_vms(teamspace: Optional[str] = None, all: bool = False, sort_by: Optional[str] = None) -> None: # noqa: A002
24
+ """List VMs in a teamspace.
25
+
26
+ Example:
27
+ lightning vm list --teamspace owner/teamspace
28
+
29
+ """
30
+ return list_impl(teamspace=teamspace, all=all, sort_by=sort_by, vm=True)
@@ -0,0 +1,31 @@
1
+ from typing import List, Optional
2
+
3
+ import click
4
+
5
+ from lightning_sdk.cli.studio.ssh import ssh_impl
6
+
7
+
8
+ @click.command("ssh")
9
+ @click.option(
10
+ "--name",
11
+ help=(
12
+ "The name of the VM to ssh into. "
13
+ "If not provided, will try to infer from environment, "
14
+ "use the default value from the config or prompt for interactive selection."
15
+ ),
16
+ )
17
+ @click.option("--teamspace", help="Override default teamspace (format: owner/teamspace)", type=click.STRING)
18
+ @click.option(
19
+ "--option",
20
+ "-o",
21
+ help="Additional options to pass to the SSH command. Can be specified multiple times.",
22
+ multiple=True,
23
+ type=click.STRING,
24
+ )
25
+ def ssh_vm(name: Optional[str] = None, teamspace: Optional[str] = None, option: Optional[List[str]] = None) -> None:
26
+ """SSH into a VM.
27
+
28
+ Example:
29
+ lightning vm ssh --name my-vm
30
+ """
31
+ return ssh_impl(name=name, teamspace=teamspace, option=option, vm=False)
@@ -0,0 +1,60 @@
1
+ from typing import Optional
2
+
3
+ import click
4
+
5
+ from lightning_sdk.cli.studio.start import start_impl
6
+ from lightning_sdk.machine import CloudProvider, Machine
7
+
8
+
9
+ @click.command("start")
10
+ @click.option(
11
+ "--name",
12
+ help=(
13
+ "The name of the VM to start. "
14
+ "If not provided, will try to infer from environment, "
15
+ "use the default value from the config or prompt for interactive selection."
16
+ ),
17
+ )
18
+ @click.option("--teamspace", help="Override default teamspace (format: owner/teamspace)")
19
+ @click.option("--create", is_flag=True, help="Create the VM if it doesn't exist")
20
+ @click.option(
21
+ "--machine",
22
+ help="The machine type to start the VM on. Defaults to CPU-4",
23
+ type=click.Choice(m.name for m in Machine.__dict__.values() if isinstance(m, Machine) and m._include_in_cli),
24
+ )
25
+ @click.option("--interruptible", is_flag=True, help="Start the VM on an interruptible instance.")
26
+ @click.option(
27
+ "--cloud-provider",
28
+ help=("The cloud provider to start the VM on. Defaults to teamspace default. Only used if --create is specified."),
29
+ type=click.Choice(m.name for m in list(CloudProvider)),
30
+ )
31
+ @click.option(
32
+ "--cloud-account",
33
+ help="The cloud account to start the VM on. Defaults to teamspace default. Only used if --create is specified.",
34
+ type=click.STRING,
35
+ )
36
+ def start_vm(
37
+ name: Optional[str] = None,
38
+ teamspace: Optional[str] = None,
39
+ create: bool = False,
40
+ machine: str = "CPU",
41
+ interruptible: bool = False,
42
+ cloud_provider: Optional[str] = None,
43
+ cloud_account: Optional[str] = None,
44
+ ) -> None:
45
+ """Start a VM.
46
+
47
+ Example:
48
+ lightning vm start --name my-vm
49
+
50
+ """
51
+ return start_impl(
52
+ name=name,
53
+ teamspace=teamspace,
54
+ create=create,
55
+ machine=machine,
56
+ interruptible=interruptible,
57
+ cloud_provider=cloud_provider,
58
+ cloud_account=cloud_account,
59
+ vm=True,
60
+ )
@@ -0,0 +1,25 @@
1
+ from typing import Optional
2
+
3
+ import click
4
+
5
+ from lightning_sdk.cli.studio.stop import stop_impl
6
+
7
+
8
+ @click.command("stop")
9
+ @click.option(
10
+ "--name",
11
+ help=(
12
+ "The name of the VM to stop. "
13
+ "If not provided, will try to infer from environment, "
14
+ "use the default value from the config or prompt for interactive selection."
15
+ ),
16
+ )
17
+ @click.option("--teamspace", help="Override default teamspace (format: owner/teamspace)")
18
+ def stop_vm(name: Optional[str] = None, teamspace: Optional[str] = None) -> None:
19
+ """Stop a VM.
20
+
21
+ Example:
22
+ lightning vm stop --name my-vm
23
+
24
+ """
25
+ return stop_impl(name=name, teamspace=teamspace, vm=True)
@@ -0,0 +1,38 @@
1
+ from typing import Optional
2
+
3
+ import click
4
+
5
+ from lightning_sdk.cli.studio.switch import switch_impl
6
+ from lightning_sdk.machine import Machine
7
+
8
+
9
+ @click.command("switch")
10
+ @click.option(
11
+ "--name",
12
+ help=(
13
+ "The name of the VM to switch to a different machine. "
14
+ "If not provided, will try to infer from environment, "
15
+ "use the default value from the config or prompt for interactive selection."
16
+ ),
17
+ )
18
+ @click.option("--teamspace", help="Override default teamspace (format: owner/teamspace)")
19
+ @click.option(
20
+ "--machine",
21
+ help="The machine type to switch the studio to.",
22
+ type=click.Choice(m.name for m in Machine.__dict__.values() if isinstance(m, Machine)),
23
+ )
24
+ @click.option("--interruptible", is_flag=True, help="Switch the studio to an interruptible instance.")
25
+ def switch_vm(
26
+ name: Optional[str] = None,
27
+ teamspace: Optional[str] = None,
28
+ machine: Optional[str] = None,
29
+ interruptible: bool = False,
30
+ ) -> None:
31
+ """Switch a VM to a different machine type."""
32
+ return switch_impl(
33
+ name=name,
34
+ teamspace=teamspace,
35
+ machine=machine,
36
+ interruptible=interruptible,
37
+ vm=True,
38
+ )
@@ -29,3 +29,4 @@ class Store:
29
29
 
30
30
 
31
31
  __GLOBAL_LIGHTNING_UNIQUE_IDS_STORE__ = Store()
32
+ _LIGHTNING_DISABLE_VERSION_CHECK = int(os.getenv("LIGHTNING_DISABLE_VERSION_CHECK", "0"))
@@ -1,4 +1,5 @@
1
1
  from lightning_sdk.api.deployment_api import (
2
+ ApiKeyAuth,
2
3
  AutoScaleConfig,
3
4
  AutoScalingMetric,
4
5
  BasicAuth,
@@ -24,4 +25,5 @@ __all__ = [
24
25
  "Secret",
25
26
  "TokenAuth",
26
27
  "Deployment",
28
+ "ApiKeyAuth",
27
29
  ]
@@ -6,6 +6,7 @@ import requests
6
6
 
7
7
  from lightning_sdk.api import UserApi
8
8
  from lightning_sdk.api.deployment_api import (
9
+ ApiKeyAuth,
9
10
  Auth,
10
11
  AutoScaleConfig,
11
12
  BasicAuth,
@@ -35,10 +36,11 @@ from lightning_sdk.services.utilities import _get_cluster
35
36
  from lightning_sdk.studio import Studio
36
37
  from lightning_sdk.teamspace import Teamspace
37
38
  from lightning_sdk.user import User
39
+ from lightning_sdk.utils.logging import TrackCallsMeta
38
40
  from lightning_sdk.utils.resolve import _resolve_deprecated_cluster, _resolve_org, _resolve_teamspace, _resolve_user
39
41
 
40
42
 
41
- class Deployment:
43
+ class Deployment(metaclass=TrackCallsMeta):
42
44
  """The Lightning AI Deployment.
43
45
 
44
46
  Allows to fully control a deployment, including retrieving the status, making new release
@@ -121,7 +123,7 @@ class Deployment:
121
123
  spot: Optional[bool] = None,
122
124
  replicas: Optional[int] = None,
123
125
  health_check: Optional[Union[HttpHealthCheck, ExecHealthCheck]] = None,
124
- auth: Optional[Union[BasicAuth, TokenAuth]] = None,
126
+ auth: Optional[Union[BasicAuth, TokenAuth, ApiKeyAuth]] = None,
125
127
  cloud_account: Optional[str] = None,
126
128
  custom_domain: Optional[str] = None,
127
129
  cluster: Optional[str] = None, # deprecated in favor of cloud_account
@@ -131,6 +133,7 @@ class Deployment:
131
133
  from_onboarding: Optional[bool] = None,
132
134
  from_litserve: Optional[bool] = None,
133
135
  max_runtime: Optional[int] = None,
136
+ path_mappings: Optional[Dict[str, str]] = None,
134
137
  ) -> None:
135
138
  """The Lightning AI Deployment.
136
139
 
@@ -162,6 +165,15 @@ class Deployment:
162
165
  Irrelevant for most machines, required for some of the top-end machines on GCP.
163
166
  If in doubt, set it. Won't have an effect on machines not requiring it.
164
167
  Defaults to 3h
168
+ path_mappings: Dictionary of path mappings. The keys are the path inside the container whereas the value
169
+ represents the data-connection name and the path inside that connection.
170
+ Should be of form
171
+ {
172
+ "<CONTAINER_PATH_1>": "<CONNECTION_NAME_1>:<PATH_WITHIN_CONNECTION_1>",
173
+ "<CONTAINER_PATH_2>": "<CONNECTION_NAME_2>"
174
+ }
175
+ If the path inside the connection is omitted it's assumed to be the root path of that connection.
176
+ Only applicable when deploying docker containers.
165
177
 
166
178
  Note:
167
179
  Since a teamspace can either be owned by an org or by a user directly,
@@ -238,6 +250,7 @@ class Deployment:
238
250
  cloudspace_id=cloudspace_id,
239
251
  max_runtime=max_runtime,
240
252
  machine_image_version=machine_image_version,
253
+ path_mappings=path_mappings,
241
254
  ),
242
255
  strategy=to_strategy(release_strategy),
243
256
  ),
@@ -274,6 +287,7 @@ class Deployment:
274
287
  quantity: Optional[int] = None,
275
288
  include_credentials: Optional[bool] = None,
276
289
  max_runtime: Optional[int] = None,
290
+ path_mappings: Optional[Dict[str, str]] = None,
277
291
  ) -> None:
278
292
  cloud_account = _resolve_deprecated_cluster(cloud_account, cluster)
279
293
 
@@ -301,6 +315,7 @@ class Deployment:
301
315
  quantity=quantity,
302
316
  include_credentials=include_credentials,
303
317
  max_runtime=max_runtime,
318
+ path_mappings=path_mappings,
304
319
  )
305
320
 
306
321
  def stop(self) -> None:
lightning_sdk/helpers.py CHANGED
@@ -1,4 +1,3 @@
1
- import functools
2
1
  import importlib
3
2
  import os
4
3
  import sys
@@ -10,51 +9,71 @@ import tqdm
10
9
  import tqdm.std
11
10
  from packaging import version as packaging_version
12
11
 
13
- __package_name__ = "lightning-sdk"
12
+ from lightning_sdk.constants import _LIGHTNING_DISABLE_VERSION_CHECK
14
13
 
15
14
 
16
- @functools.lru_cache(maxsize=1)
17
- def _get_newer_version(curr_version: str) -> Optional[str]:
18
- """Check PyPI for newer versions of ``lightning-sdk``.
19
-
20
- Returning the newest version if different from the current or ``None`` otherwise.
15
+ class VersionChecker:
16
+ """Handles version checking and upgrade prompts for lightning-sdk.
21
17
 
18
+ This class ensures that version check warnings are only shown once per session,
19
+ preventing duplicate warnings in multithreaded scenarios.
22
20
  """
23
- if packaging_version.parse(curr_version).is_prerelease:
24
- return None
25
- try:
26
- response = requests.get(f"https://pypi.org/pypi/{__package_name__}/json")
27
- response_json = response.json()
28
- releases = response_json["releases"]
29
- if curr_version not in releases:
30
- # Always return None if not installed from PyPI (e.g. dev versions)
21
+
22
+ def __init__(self, package_name: str = "lightning-sdk") -> None:
23
+ self.package_name = package_name
24
+ self._warning_shown = False
25
+ self._cached_version: Optional[str] = None
26
+
27
+ def _get_newer_version(self, curr_version: str) -> Optional[str]:
28
+ """Check PyPI for newer versions of ``lightning-sdk``.
29
+
30
+ Returning the newest version if different from the current or ``None`` otherwise.
31
+ """
32
+ if self._cached_version is not None:
33
+ return self._cached_version
34
+
35
+ if _LIGHTNING_DISABLE_VERSION_CHECK == 1 or packaging_version.parse(curr_version).is_prerelease:
36
+ self._cached_version = None
31
37
  return None
32
- latest_version = response_json["info"]["version"]
33
- parsed_version = packaging_version.parse(latest_version)
34
- is_invalid = response_json["info"]["yanked"] or parsed_version.is_devrelease or parsed_version.is_prerelease
35
- return None if curr_version == latest_version or is_invalid else latest_version
36
- except requests.exceptions.RequestException:
37
- return None
38
38
 
39
+ try:
40
+ response = requests.get(f"https://pypi.org/pypi/{self.package_name}/json")
41
+ response_json = response.json()
42
+ releases = response_json["releases"]
43
+ if curr_version not in releases:
44
+ # Always return None if not installed from PyPI (e.g. dev versions)
45
+ self._cached_version = None
46
+ return None
47
+ latest_version = response_json["info"]["version"]
48
+ parsed_version = packaging_version.parse(latest_version)
49
+ is_invalid = response_json["info"]["yanked"] or parsed_version.is_devrelease or parsed_version.is_prerelease
50
+ self._cached_version = None if curr_version == latest_version or is_invalid else latest_version
51
+ return self._cached_version
52
+ except requests.exceptions.RequestException:
53
+ self._cached_version = None
54
+ return None
39
55
 
40
- def _check_version_and_prompt_upgrade(curr_version: str) -> None:
41
- """Checks that the current version of ``lightning-sdk`` is the latest on PyPI.
56
+ def check_and_prompt_upgrade(self, curr_version: str) -> None:
57
+ """Checks that the current version of ``lightning-sdk`` is the latest on PyPI.
42
58
 
43
- If not, warn the user to upgrade ``lightning-sdk``.
59
+ If not, warn the user to upgrade ``lightning-sdk``.
60
+ Tracks if the warning has already been shown in this session to avoid duplicate warnings.
61
+ """
62
+ if self._warning_shown:
63
+ return
44
64
 
45
- """
46
- new_version = _get_newer_version(curr_version)
47
- if new_version:
48
- warnings.warn(
49
- f"A newer version of {__package_name__} is available ({new_version}). "
50
- f"Please consider upgrading with `pip install -U {__package_name__}`. "
51
- "Not all platform functionality can be guaranteed to work with the current version.",
52
- UserWarning,
53
- )
54
- return
55
-
56
-
57
- def _set_tqdm_envvars_noninteractive() -> None:
65
+ new_version = self._get_newer_version(curr_version)
66
+ if new_version:
67
+ warnings.warn(
68
+ f"A newer version of {self.package_name} is available ({new_version}). "
69
+ f"Please consider upgrading with `pip install -U {self.package_name}`. "
70
+ "Not all platform functionality can be guaranteed to work with the current version.",
71
+ UserWarning,
72
+ )
73
+ self._warning_shown = True
74
+
75
+
76
+ def set_tqdm_envvars_noninteractive() -> None:
58
77
  # note: stderr is the default stream tqdm writes progressbars to
59
78
  # so we check that one.
60
79
  if os.isatty(sys.stderr.fileno()):
lightning_sdk/job/base.py CHANGED
@@ -4,7 +4,8 @@ from typing import TYPE_CHECKING, Any, Dict, Optional, TypedDict, Union
4
4
 
5
5
  from lightning_sdk.api.cloud_account_api import CloudAccountApi
6
6
  from lightning_sdk.api.utils import _get_cloud_url
7
- from lightning_sdk.utils.resolve import _resolve_deprecated_cluster, _resolve_teamspace, in_studio
7
+ from lightning_sdk.utils.logging import TrackCallsABCMeta
8
+ from lightning_sdk.utils.resolve import _resolve_deprecated_cluster, _resolve_teamspace, in_studio, skip_studio_setup
8
9
 
9
10
  if TYPE_CHECKING:
10
11
  from lightning_sdk.machine import CloudProvider, Machine
@@ -29,7 +30,7 @@ class JobDict(MachineDict):
29
30
  total_cost: float
30
31
 
31
32
 
32
- class _BaseJob(ABC):
33
+ class _BaseJob(ABC, metaclass=TrackCallsABCMeta):
33
34
  """Base interface to all job types."""
34
35
 
35
36
  def __init__(
@@ -90,6 +91,7 @@ class _BaseJob(ABC):
90
91
  path_mappings: Optional[Dict[str, str]] = None,
91
92
  max_runtime: Optional[int] = None,
92
93
  cluster: Optional[str] = None, # deprecated in favor of cloud_account
94
+ reuse_snapshot: bool = True,
93
95
  ) -> "_BaseJob":
94
96
  """Run async workloads using a docker image or a compute environment from your studio.
95
97
 
@@ -134,6 +136,8 @@ class _BaseJob(ABC):
134
136
  Irrelevant for most machines, required for some of the top-end machines on GCP.
135
137
  If in doubt, set it. Won't have an effect on machines not requiring it.
136
138
  Defaults to 3h
139
+ reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
140
+ submitted. Turning this off may result in longer job startup times. Defaults to True.
137
141
  """
138
142
  from lightning_sdk.lightning_cloud.openapi.rest import ApiException
139
143
  from lightning_sdk.studio import Studio
@@ -145,9 +149,15 @@ class _BaseJob(ABC):
145
149
 
146
150
  if image is None:
147
151
  if not isinstance(studio, Studio):
148
- studio = Studio(
149
- name=studio, teamspace=teamspace, org=org, user=user, cloud_account=cloud_account, create_ok=False
150
- )
152
+ with skip_studio_setup():
153
+ studio = Studio(
154
+ name=studio,
155
+ teamspace=teamspace,
156
+ org=org,
157
+ user=user,
158
+ cloud_account=cloud_account,
159
+ create_ok=False,
160
+ )
151
161
 
152
162
  # studio is a Studio instance at this point
153
163
  if teamspace is None:
@@ -192,7 +202,8 @@ class _BaseJob(ABC):
192
202
  )
193
203
  if cloud_account is None and in_studio():
194
204
  try:
195
- resolve_studio = Studio(teamspace=teamspace, user=user, org=org)
205
+ with skip_studio_setup():
206
+ resolve_studio = Studio(teamspace=teamspace, user=user, org=org)
196
207
  cloud_account = resolve_studio.cloud_account
197
208
  except (ValueError, ApiException):
198
209
  warnings.warn("Could not infer cloud account from studio. Using teamspace default.")
@@ -224,6 +235,7 @@ class _BaseJob(ABC):
224
235
  entrypoint=entrypoint,
225
236
  path_mappings=path_mappings,
226
237
  max_runtime=max_runtime,
238
+ reuse_snapshot=reuse_snapshot,
227
239
  )
228
240
 
229
241
  @abstractmethod
@@ -244,6 +256,7 @@ class _BaseJob(ABC):
244
256
  entrypoint: str = "sh -c",
245
257
  path_mappings: Optional[Dict[str, str]] = None,
246
258
  max_runtime: Optional[int] = None,
259
+ reuse_snapshot: bool = True,
247
260
  ) -> "_BaseJob":
248
261
  """Submit a new job to the Lightning AI platform.
249
262
 
@@ -283,6 +296,8 @@ class _BaseJob(ABC):
283
296
  Irrelevant for most machines, required for some of the top-end machines on GCP.
284
297
  If in doubt, set it. Won't have an effect on machines not requiring it.
285
298
  Defaults to 3h
299
+ reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
300
+ submitted. Turning this off may result in longer job startup times. Defaults to True.
286
301
  """
287
302
 
288
303
  @abstractmethod
lightning_sdk/job/job.py CHANGED
@@ -97,6 +97,7 @@ class Job(_BaseJob):
97
97
  artifacts_local: Optional[str] = None, # deprecated in terms of path_mappings
98
98
  artifacts_remote: Optional[str] = None, # deprecated in terms of path_mappings
99
99
  cluster: Optional[str] = None, # deprecated in favor of cloud_account
100
+ reuse_snapshot: bool = True,
100
101
  ) -> "Job":
101
102
  """Run async workloads using a docker image or a compute environment from your studio.
102
103
 
@@ -140,6 +141,8 @@ class Job(_BaseJob):
140
141
  Irrelevant for most machines, required for some of the top-end machines on GCP.
141
142
  If in doubt, set it. Won't have an effect on machines not requiring it.
142
143
  Defaults to 3h
144
+ reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
145
+ submitted. Turning this off may result in longer job startup times. Defaults to True.
143
146
  """
144
147
  ret_val = super().run(
145
148
  name=name,
@@ -162,6 +165,7 @@ class Job(_BaseJob):
162
165
  path_mappings=path_mappings,
163
166
  max_runtime=max_runtime,
164
167
  cluster=cluster,
168
+ reuse_snapshot=reuse_snapshot,
165
169
  )
166
170
  # required for typing with "Job"
167
171
  assert isinstance(ret_val, cls)
@@ -186,6 +190,7 @@ class Job(_BaseJob):
186
190
  artifacts_local: Optional[str] = None, # deprecated in terms of path_mappings
187
191
  artifacts_remote: Optional[str] = None, # deprecated in terms of path_mappings
188
192
  max_runtime: Optional[int] = None,
193
+ reuse_snapshot: bool = True,
189
194
  ) -> "Job":
190
195
  """Submit a new job to the Lightning AI platform.
191
196
 
@@ -224,6 +229,8 @@ class Job(_BaseJob):
224
229
  Irrelevant for most machines, required for some of the top-end machines on GCP.
225
230
  If in doubt, set it. Won't have an effect on machines not requiring it.
226
231
  Defaults to 3h
232
+ reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
233
+ submitted. Turning this off may result in longer job startup times. Defaults to True.
227
234
  """
228
235
  self._job = self._internal_job._submit(
229
236
  machine=machine,
@@ -241,6 +248,7 @@ class Job(_BaseJob):
241
248
  artifacts_local=artifacts_local,
242
249
  artifacts_remote=artifacts_remote,
243
250
  max_runtime=max_runtime,
251
+ reuse_snapshot=reuse_snapshot,
244
252
  )
245
253
  return self
246
254
 
@@ -268,6 +276,11 @@ class Job(_BaseJob):
268
276
  """The machine type the job is running on."""
269
277
  return self._internal_job.machine
270
278
 
279
+ @property
280
+ def public_ip(self) -> Optional[str]:
281
+ """The public IP address of the machine the job is running on."""
282
+ return self._internal_job.public_ip
283
+
271
284
  @property
272
285
  def artifact_path(self) -> Optional[str]:
273
286
  """Path to the artifacts created by the job within the distributed teamspace filesystem."""
lightning_sdk/job/v1.py CHANGED
@@ -54,6 +54,7 @@ class _JobV1(_BaseJob):
54
54
  cloud_provider: Optional[str] = None,
55
55
  interruptible: bool = False,
56
56
  cluster: Optional[str] = None, # deprecated in favor of cloud_account
57
+ reuse_snapshot: bool = True,
57
58
  ) -> "_BaseJob":
58
59
  """Start a new async workload from your studio.
59
60
 
@@ -89,6 +90,7 @@ class _JobV1(_BaseJob):
89
90
  cluster=cluster,
90
91
  path_mappings=None,
91
92
  max_runtime=None,
93
+ reuse_snapshot=reuse_snapshot,
92
94
  )
93
95
 
94
96
  def _submit(
@@ -108,6 +110,7 @@ class _JobV1(_BaseJob):
108
110
  entrypoint: str = "sh -c",
109
111
  path_mappings: Optional[Dict[str, str]] = None,
110
112
  max_runtime: Optional[int] = None,
113
+ reuse_snapshot: bool = True,
111
114
  ) -> "_JobV1":
112
115
  """Submit a job to run on a machine.
113
116
 
@@ -181,6 +184,14 @@ class _JobV1(_BaseJob):
181
184
  """Get the machine the job is running on."""
182
185
  return self.work.machine
183
186
 
187
+ @property
188
+ def public_ip(self) -> Optional[str]:
189
+ """Get the public IP of the machine the job is running on."""
190
+ try:
191
+ return self._job.status.ip_address
192
+ except AttributeError:
193
+ return None
194
+
184
195
  @property
185
196
  def name(self) -> str:
186
197
  """The name of the job."""
lightning_sdk/job/v2.py CHANGED
@@ -53,6 +53,7 @@ class _JobV2(_BaseJob):
53
53
  max_runtime: Optional[int] = None,
54
54
  artifacts_local: Optional[str] = None, # deprecated in favor of path_mappings
55
55
  artifacts_remote: Optional[str] = None, # deprecated in favor of path_mappings
56
+ reuse_snapshot: bool = True,
56
57
  ) -> "_JobV2":
57
58
  """Submit a new job to the Lightning AI platform.
58
59
 
@@ -87,6 +88,8 @@ class _JobV2(_BaseJob):
87
88
  Irrelevant for most machines, required for some of the top-end machines on GCP.
88
89
  If in doubt, set it. Won't have an effect on machines not requiring it.
89
90
  Defaults to 3h
91
+ reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
92
+ submitted. Turning this off may result in longer job startup times. Defaults to True.
90
93
  """
91
94
  # Command is required if Studio is provided to know what to run
92
95
  # Image is mutually exclusive with Studio
@@ -129,6 +132,7 @@ class _JobV2(_BaseJob):
129
132
  entrypoint=entrypoint,
130
133
  path_mappings=path_mappings,
131
134
  max_runtime=max_runtime,
135
+ reuse_snapshot=reuse_snapshot,
132
136
  )
133
137
  self._job = submitted
134
138
  self._name = submitted.name
@@ -173,6 +177,14 @@ class _JobV2(_BaseJob):
173
177
  _get_org_id(self.teamspace),
174
178
  )
175
179
 
180
+ @property
181
+ def public_ip(self) -> Optional[str]:
182
+ """Get the public IP of the machine the job is running on."""
183
+ try:
184
+ return self._job.public_ip_address
185
+ except AttributeError:
186
+ return None
187
+
176
188
  @property
177
189
  def artifact_path(self) -> Optional[str]:
178
190
  """The path to the artifacts of the job within the distributed teamspace filesystem."""