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.
- lightning_sdk/__init__.py +13 -7
- lightning_sdk/__version__.py +3 -0
- lightning_sdk/agents.py +2 -1
- lightning_sdk/ai_hub.py +2 -1
- lightning_sdk/api/__init__.py +2 -0
- lightning_sdk/api/base_studio_api.py +13 -9
- lightning_sdk/api/cloud_account_api.py +31 -10
- lightning_sdk/api/deployment_api.py +27 -1
- lightning_sdk/api/job_api.py +16 -12
- lightning_sdk/api/license_api.py +26 -59
- lightning_sdk/api/llm_api.py +25 -2
- lightning_sdk/api/mmt_api.py +5 -2
- lightning_sdk/api/studio_api.py +252 -55
- lightning_sdk/api/teamspace_api.py +106 -30
- lightning_sdk/api/user_api.py +56 -2
- lightning_sdk/api/utils.py +108 -18
- lightning_sdk/base_studio.py +51 -27
- lightning_sdk/cli/__init__.py +1 -0
- lightning_sdk/cli/base_studio/__init__.py +10 -0
- lightning_sdk/cli/base_studio/list.py +43 -0
- lightning_sdk/cli/config/__init__.py +14 -0
- lightning_sdk/cli/config/get.py +57 -0
- lightning_sdk/cli/config/set.py +92 -0
- lightning_sdk/cli/config/show.py +9 -0
- lightning_sdk/cli/entrypoint.py +71 -71
- lightning_sdk/cli/groups.py +56 -0
- lightning_sdk/cli/job/__init__.py +7 -0
- lightning_sdk/cli/{clusters_menu.py → legacy/clusters_menu.py} +9 -6
- lightning_sdk/cli/{configure.py → legacy/configure.py} +2 -2
- lightning_sdk/cli/{connect.py → legacy/connect.py} +2 -2
- lightning_sdk/cli/{create.py → legacy/create.py} +12 -14
- lightning_sdk/cli/{delete.py → legacy/delete.py} +5 -5
- lightning_sdk/cli/legacy/deploy/__init__.py +0 -0
- lightning_sdk/cli/{deploy → legacy/deploy}/_auth.py +5 -6
- lightning_sdk/cli/{deploy → legacy/deploy}/devbox.py +8 -2
- lightning_sdk/cli/{deploy → legacy/deploy}/serve.py +19 -8
- lightning_sdk/cli/{download.py → legacy/download.py} +14 -15
- lightning_sdk/cli/legacy/entrypoint.py +110 -0
- lightning_sdk/cli/{generate.py → legacy/generate.py} +1 -1
- lightning_sdk/cli/{inspection.py → legacy/inspection.py} +1 -1
- lightning_sdk/cli/{job_and_mmt_action.py → legacy/job_and_mmt_action.py} +6 -6
- lightning_sdk/cli/{jobs_menu.py → legacy/jobs_menu.py} +1 -1
- lightning_sdk/cli/{list.py → legacy/list.py} +12 -13
- lightning_sdk/cli/{mmts_menu.py → legacy/mmts_menu.py} +1 -1
- lightning_sdk/cli/{open.py → legacy/open.py} +4 -4
- lightning_sdk/cli/{start.py → legacy/start.py} +1 -0
- lightning_sdk/cli/{stop.py → legacy/stop.py} +1 -1
- lightning_sdk/cli/{switch.py → legacy/switch.py} +1 -0
- lightning_sdk/cli/{teamspace_menu.py → legacy/teamspace_menu.py} +1 -1
- lightning_sdk/cli/{upload.py → legacy/upload.py} +7 -8
- lightning_sdk/cli/license/__init__.py +14 -0
- lightning_sdk/cli/license/get.py +15 -0
- lightning_sdk/cli/license/list.py +45 -0
- lightning_sdk/cli/license/set.py +13 -0
- lightning_sdk/cli/mmt/__init__.py +7 -0
- lightning_sdk/cli/studio/__init__.py +24 -0
- lightning_sdk/cli/studio/connect.py +139 -0
- lightning_sdk/cli/studio/create.py +96 -0
- lightning_sdk/cli/studio/delete.py +49 -0
- lightning_sdk/cli/studio/list.py +85 -0
- lightning_sdk/cli/studio/ssh.py +64 -0
- lightning_sdk/cli/studio/start.py +115 -0
- lightning_sdk/cli/studio/stop.py +45 -0
- lightning_sdk/cli/studio/switch.py +66 -0
- lightning_sdk/cli/utils/__init__.py +7 -0
- lightning_sdk/cli/utils/cloud_account_map.py +10 -0
- lightning_sdk/cli/utils/get_base_studio.py +24 -0
- lightning_sdk/cli/utils/handle_machine_and_gpus_args.py +69 -0
- lightning_sdk/cli/utils/logging.py +122 -0
- lightning_sdk/cli/utils/owner_selection.py +110 -0
- lightning_sdk/cli/utils/resolve.py +28 -0
- lightning_sdk/cli/utils/richt_print.py +35 -0
- lightning_sdk/cli/utils/save_to_config.py +27 -0
- lightning_sdk/cli/utils/ssh_connection.py +59 -0
- lightning_sdk/cli/utils/studio_selection.py +113 -0
- lightning_sdk/cli/utils/teamspace_selection.py +125 -0
- lightning_sdk/cli/vm/__init__.py +20 -0
- lightning_sdk/cli/vm/create.py +33 -0
- lightning_sdk/cli/vm/delete.py +25 -0
- lightning_sdk/cli/vm/list.py +30 -0
- lightning_sdk/cli/vm/ssh.py +31 -0
- lightning_sdk/cli/vm/start.py +60 -0
- lightning_sdk/cli/vm/stop.py +25 -0
- lightning_sdk/cli/vm/switch.py +38 -0
- lightning_sdk/constants.py +1 -0
- lightning_sdk/deployment/__init__.py +2 -0
- lightning_sdk/deployment/deployment.py +17 -2
- lightning_sdk/helpers.py +56 -37
- lightning_sdk/job/base.py +21 -6
- lightning_sdk/job/job.py +13 -0
- lightning_sdk/job/v1.py +11 -0
- lightning_sdk/job/v2.py +12 -0
- lightning_sdk/lightning_cloud/login.py +320 -10
- lightning_sdk/lightning_cloud/openapi/__init__.py +113 -3
- lightning_sdk/lightning_cloud/openapi/api/__init__.py +3 -0
- lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +713 -75
- lightning_sdk/lightning_cloud/openapi/api/auth_service_api.py +376 -0
- lightning_sdk/lightning_cloud/openapi/api/billing_service_api.py +191 -1
- lightning_sdk/lightning_cloud/openapi/api/cloud_space_environment_template_service_api.py +5 -1
- lightning_sdk/lightning_cloud/openapi/api/cloud_space_service_api.py +420 -0
- lightning_sdk/lightning_cloud/openapi/api/cloudy_service_api.py +0 -97
- lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +420 -0
- lightning_sdk/lightning_cloud/openapi/api/data_connection_service_api.py +101 -0
- lightning_sdk/lightning_cloud/openapi/api/incidents_service_api.py +1058 -0
- lightning_sdk/lightning_cloud/openapi/api/jobs_service_api.py +121 -0
- lightning_sdk/lightning_cloud/openapi/api/k8_s_cluster_service_api.py +1742 -94
- lightning_sdk/lightning_cloud/openapi/api/markets_service_api.py +145 -0
- lightning_sdk/lightning_cloud/openapi/api/models_store_api.py +4 -4
- lightning_sdk/lightning_cloud/openapi/api/product_license_service_api.py +108 -108
- lightning_sdk/lightning_cloud/openapi/api/projects_service_api.py +105 -0
- lightning_sdk/lightning_cloud/openapi/api/schedules_service_api.py +347 -0
- lightning_sdk/lightning_cloud/openapi/api/sdk_command_history_service_api.py +141 -0
- lightning_sdk/lightning_cloud/openapi/api/storage_service_api.py +761 -1
- lightning_sdk/lightning_cloud/openapi/configuration.py +3 -19
- lightning_sdk/lightning_cloud/openapi/models/__init__.py +110 -3
- lightning_sdk/lightning_cloud/openapi/models/assistant_id_conversations_body.py +15 -15
- lightning_sdk/lightning_cloud/openapi/models/cloudspace_id_visibility_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/cluster_id_kubernetestemplates_body.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/cluster_id_metrics_body.py +131 -1
- lightning_sdk/lightning_cloud/openapi/models/create.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/create_machine_request_represents_the_request_to_create_a_machine.py +461 -0
- lightning_sdk/lightning_cloud/openapi/models/deployments_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/externalv1_cloud_space_instance_status.py +105 -1
- lightning_sdk/lightning_cloud/openapi/models/externalv1_user_status.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/id_codeconfig_body.py +3 -81
- lightning_sdk/lightning_cloud/openapi/models/id_fork_body1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/id_render_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/id_sleepconfig_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/id_transfer_body.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/incident_id_messages_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/incidents_id_body.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/job_id_reportroutingtelemetry_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/kubernetestemplates_id_body.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/license_key_validate_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/message_id_actions_body.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/messages_message_id_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/metricsstream_create_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/models_model_id_body.py +109 -31
- lightning_sdk/lightning_cloud/openapi/models/models_model_id_body1.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/orgs_id_body.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/project_id_storage_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/project_id_storagetransfers_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/project_tab_management_messages.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/projects_id_body.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/storage_complete_body.py +41 -15
- lightning_sdk/lightning_cloud/openapi/models/storagetransfers_validate_body.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/update1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/uploads_upload_id_body1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/user_id_affiliatelinks_body.py +107 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_abort_storage_transfer_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_aggregated_pod_metrics.py +799 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_ai_pod_v1.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_assistant_session_daily_aggregated.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_billing_tier.py +0 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cancel_running_cloud_space_instance_transfer_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_provider.py +2 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template_config.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_specialized_view.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_transfer_metadata.py +147 -17
- lightning_sdk/lightning_cloud/openapi/models/v1_cloudflare_v1.py +3 -29
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_accelerator.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_capacity_reservation.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_metrics.py +1527 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_security_options.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_spec.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_container_metrics.py +21 -21
- lightning_sdk/lightning_cloud/openapi/models/v1_create_incident_request.py +305 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_license_request.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_machine_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_model_metrics_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_project_request.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_create_sdk_command_history_request.py +253 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_sdk_command_history_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_daily_model_metrics.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_data_connection.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_incident_message_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_incident_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_kubernetes_template_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_license_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_machine_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_deployment.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_external_cluster_spec.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_external_search_user.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_filestore_data_connection.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_filesystem_metric.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_firewall_rule.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_required_balance_status_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_transfer_estimate_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_latest_model_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_machine_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_market_pricing_response.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_model_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_temp_bucket_credentials_response.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +41 -15
- lightning_sdk/lightning_cloud/openapi/models/v1_google_cloud_direct_v1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_group_node_metrics.py +1215 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_group_pod_metrics.py +1241 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_guest_login_request.py +177 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_guest_login_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_guest_user.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident.py +565 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_detail.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_event.py +591 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_message.py +253 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_severity.py +105 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_type.py +108 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_job.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_job_spec.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_k8s_incident_indexes.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kai_scheduler_queue_metrics.py +627 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_aws_config.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_settings_v1.py +253 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_v1.py +107 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_template.py +357 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_template_property.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_lambda_labs_direct_v1.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_license.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_lightning_elastic_cluster_v1.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_aggregated_pod_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_metric_timestamps_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_namespace_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_namespace_user_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_conversation_message_actions_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_filesystem_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_group_pod_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_incident_events_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_incident_messages_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_incidents_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_kai_scheduler_queues_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_kubernetes_templates_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/{v1_list_product_licenses_response.py → v1_list_license_response.py} +16 -16
- lightning_sdk/lightning_cloud/openapi/models/v1_list_machines_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_platform_notifications_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_schedule_runs_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_storage_transfers_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_lustre_data_connection.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_machine.py +617 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_machine_direct_v1.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_request.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_response.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_managed_model.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_market_price.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_membership.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_message_action.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_metrics_stream.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_model_metrics.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_namespace_metrics.py +591 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_namespace_user_metrics.py +435 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_nebius_direct_v1.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_node_metrics.py +361 -23
- lightning_sdk/lightning_cloud/openapi/models/v1_notification_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_organization.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_pause_storage_transfer_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_platform_notification.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_pod_metrics.py +335 -23
- lightning_sdk/lightning_cloud/openapi/models/v1_project.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_cluster_binding.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_membership.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_settings.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_tab.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/{v1_product_license_check_response.py → v1_purchase_annual_upsell_request.py} +23 -23
- lightning_sdk/lightning_cloud/openapi/models/v1_purchase_annual_upsell_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_quote_annual_upsell_response.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_render_kubernetes_template_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_report_deployment_routing_telemetry_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_required_balance_reason.py +107 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_reset_api_key_request.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_reset_api_key_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_resource_visibility.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_resume_storage_transfer_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_routing_telemetry.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_rule_resource.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_schedule_run.py +357 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_sdk_command_history_severity.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_sdk_command_history_type.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_secret_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_server_alert_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_slack_notifier.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_slack_notifier_type.py +105 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_storage_asset.py +133 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_storage_transfer.py +435 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_storage_transfer_status.py +108 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_token_login_request.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_token_login_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_token_owner_type.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_cloud_space_instance_config_request.py +3 -81
- lightning_sdk/lightning_cloud/openapi/models/v1_update_project_tab_order_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +41 -15
- lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +444 -600
- lightning_sdk/lightning_cloud/openapi/models/v1_validate_license_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_validate_storage_transfer_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_voltage_park_direct_v1.py +29 -3
- lightning_sdk/lightning_cloud/rest_client.py +48 -45
- lightning_sdk/lightning_cloud/utils/data_connection.py +51 -1
- lightning_sdk/llm/llm.py +175 -56
- lightning_sdk/llm/public_assistants.py +44 -7
- lightning_sdk/machine.py +21 -2
- lightning_sdk/mmt/base.py +7 -0
- lightning_sdk/mmt/mmt.py +11 -3
- lightning_sdk/mmt/v1.py +3 -1
- lightning_sdk/mmt/v2.py +4 -0
- lightning_sdk/owner.py +2 -1
- lightning_sdk/pipeline/steps.py +6 -0
- lightning_sdk/plugin.py +6 -1
- lightning_sdk/studio.py +294 -53
- lightning_sdk/teamspace.py +167 -7
- lightning_sdk/user.py +19 -1
- lightning_sdk/utils/config.py +179 -0
- lightning_sdk/utils/license.py +13 -0
- lightning_sdk/utils/logging.py +79 -0
- lightning_sdk/utils/names.py +1179 -0
- lightning_sdk/utils/progress.py +283 -0
- lightning_sdk/utils/resolve.py +82 -7
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/METADATA +2 -1
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/RECORD +328 -169
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/entry_points.txt +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_product_license.py +0 -435
- lightning_sdk/services/license.py +0 -363
- /lightning_sdk/cli/{deploy → legacy}/__init__.py +0 -0
- /lightning_sdk/cli/{ai_hub.py → legacy/ai_hub.py} +0 -0
- /lightning_sdk/cli/{docker_cli.py → legacy/docker_cli.py} +0 -0
- /lightning_sdk/cli/{exceptions.py → legacy/exceptions.py} +0 -0
- /lightning_sdk/cli/{run.py → legacy/run.py} +0 -0
- /lightning_sdk/cli/{studios_menu.py → legacy/studios_menu.py} +0 -0
- /lightning_sdk/cli/{coloring.py → utils/coloring.py} +0 -0
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/LICENSE +0 -0
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/WHEEL +0 -0
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/top_level.txt +0 -0
lightning_sdk/__init__.py
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
|
+
from lightning_sdk.__version__ import __version__
|
|
1
2
|
from lightning_sdk.agents import Agent
|
|
2
3
|
from lightning_sdk.ai_hub import AIHub
|
|
3
4
|
from lightning_sdk.constants import __GLOBAL_LIGHTNING_UNIQUE_IDS_STORE__ # noqa: F401
|
|
4
5
|
from lightning_sdk.deployment import Deployment
|
|
5
|
-
from lightning_sdk.helpers import
|
|
6
|
+
from lightning_sdk.helpers import VersionChecker, set_tqdm_envvars_noninteractive
|
|
6
7
|
from lightning_sdk.job import Job
|
|
7
8
|
from lightning_sdk.machine import CloudProvider, Machine
|
|
8
9
|
from lightning_sdk.mmt import MMT
|
|
9
10
|
from lightning_sdk.organization import Organization
|
|
10
11
|
from lightning_sdk.plugin import JobsPlugin, MultiMachineTrainingPlugin, Plugin, SlurmJobsPlugin
|
|
11
12
|
from lightning_sdk.status import Status
|
|
12
|
-
from lightning_sdk.studio import Studio
|
|
13
|
-
from lightning_sdk.teamspace import Teamspace
|
|
13
|
+
from lightning_sdk.studio import VM, Studio
|
|
14
|
+
from lightning_sdk.teamspace import ConnectionType, FolderLocation, Teamspace
|
|
14
15
|
from lightning_sdk.user import User
|
|
15
16
|
|
|
16
17
|
__all__ = [
|
|
18
|
+
"MMT",
|
|
19
|
+
"VM",
|
|
17
20
|
"AIHub",
|
|
18
21
|
"Agent",
|
|
19
22
|
"CloudProvider",
|
|
23
|
+
"ConnectionType",
|
|
20
24
|
"Deployment",
|
|
25
|
+
"FolderLocation",
|
|
21
26
|
"Job",
|
|
22
27
|
"JobsPlugin",
|
|
23
28
|
"Machine",
|
|
24
|
-
"MMT",
|
|
25
29
|
"MultiMachineTrainingPlugin",
|
|
26
30
|
"Organization",
|
|
27
31
|
"Plugin",
|
|
@@ -30,8 +34,10 @@ __all__ = [
|
|
|
30
34
|
"Studio",
|
|
31
35
|
"Teamspace",
|
|
32
36
|
"User",
|
|
37
|
+
"__version__",
|
|
33
38
|
]
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
_version_checker = VersionChecker()
|
|
41
|
+
_version_checker.check_and_prompt_upgrade(__version__)
|
|
42
|
+
|
|
43
|
+
set_tqdm_envvars_noninteractive()
|
lightning_sdk/agents.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from typing import List, Optional
|
|
2
2
|
|
|
3
3
|
from lightning_sdk.api.agents_api import AgentApi
|
|
4
|
+
from lightning_sdk.utils.logging import TrackCallsMeta
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
class Agent:
|
|
7
|
+
class Agent(metaclass=TrackCallsMeta):
|
|
7
8
|
def __init__(self, agent_id: str) -> None:
|
|
8
9
|
self.id = agent_id
|
|
9
10
|
self._agent_api = AgentApi()
|
lightning_sdk/ai_hub.py
CHANGED
|
@@ -5,6 +5,7 @@ from lightning_sdk.api import AIHubApi
|
|
|
5
5
|
from lightning_sdk.api.utils import _get_cloud_url
|
|
6
6
|
from lightning_sdk.lightning_cloud.openapi.models import V1Deployment
|
|
7
7
|
from lightning_sdk.user import User
|
|
8
|
+
from lightning_sdk.utils.logging import TrackCallsMeta
|
|
8
9
|
from lightning_sdk.utils.resolve import _resolve_teamspace
|
|
9
10
|
|
|
10
11
|
if TYPE_CHECKING:
|
|
@@ -12,7 +13,7 @@ if TYPE_CHECKING:
|
|
|
12
13
|
from lightning_sdk.machine import Machine
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
class AIHub:
|
|
16
|
+
class AIHub(metaclass=TrackCallsMeta):
|
|
16
17
|
"""An interface to interact with the AI Hub.
|
|
17
18
|
|
|
18
19
|
Example:
|
lightning_sdk/api/__init__.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from lightning_sdk.api.agents_api import AgentApi
|
|
2
2
|
from lightning_sdk.api.ai_hub_api import AIHubApi
|
|
3
|
+
from lightning_sdk.api.cloud_account_api import CloudAccountApi
|
|
3
4
|
from lightning_sdk.api.org_api import OrgApi
|
|
4
5
|
from lightning_sdk.api.studio_api import StudioApi
|
|
5
6
|
from lightning_sdk.api.teamspace_api import TeamspaceApi
|
|
@@ -12,4 +13,5 @@ __all__ = [
|
|
|
12
13
|
"UserApi",
|
|
13
14
|
"AgentApi",
|
|
14
15
|
"AIHubApi",
|
|
16
|
+
"CloudAccountApi",
|
|
15
17
|
]
|
|
@@ -15,24 +15,28 @@ class BaseStudioApi:
|
|
|
15
15
|
def __init__(self) -> None:
|
|
16
16
|
self._client = LightningClient(retry=False, max_tries=0)
|
|
17
17
|
|
|
18
|
-
def get_base_studio(self, base_studio_id: str, org_id: str) -> V1CloudSpaceEnvironmentTemplate:
|
|
18
|
+
def get_base_studio(self, base_studio_id: str, org_id: Optional[str] = None) -> V1CloudSpaceEnvironmentTemplate:
|
|
19
19
|
"""Retrieve the base studio by its ID."""
|
|
20
20
|
try:
|
|
21
21
|
return self._client.cloud_space_environment_template_service_get_cloud_space_environment_template(
|
|
22
|
-
base_studio_id, org_id=org_id
|
|
22
|
+
base_studio_id, org_id=org_id or ""
|
|
23
23
|
)
|
|
24
24
|
except ValueError as e:
|
|
25
25
|
raise ValueError(f"Base studio {base_studio_id} does not exist") from e
|
|
26
26
|
|
|
27
|
-
def get_all_base_studios(self, org_id: str
|
|
27
|
+
def get_all_base_studios(self, org_id: Optional[str]) -> V1ListCloudSpaceEnvironmentTemplatesResponse:
|
|
28
28
|
"""Retrieve all base studios for a given organization."""
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
org_id=org_id
|
|
32
|
-
)
|
|
33
|
-
return self._client.cloud_space_environment_template_service_list_cloud_space_environment_templates(
|
|
34
|
-
org_id=org_id
|
|
29
|
+
result = self._client.cloud_space_environment_template_service_list_managed_cloud_space_environment_templates(
|
|
30
|
+
org_id=org_id or ""
|
|
35
31
|
)
|
|
32
|
+
if org_id is not None:
|
|
33
|
+
org_templates = (
|
|
34
|
+
self._client.cloud_space_environment_template_service_list_cloud_space_environment_templates(
|
|
35
|
+
org_id=org_id
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
result.templates = result.templates + org_templates.templates
|
|
39
|
+
return result
|
|
36
40
|
|
|
37
41
|
def update_base_studio(
|
|
38
42
|
self,
|
|
@@ -13,6 +13,7 @@ from lightning_sdk.lightning_cloud.rest_client import LightningClient
|
|
|
13
13
|
|
|
14
14
|
if TYPE_CHECKING:
|
|
15
15
|
from lightning_sdk.machine import CloudProvider
|
|
16
|
+
from lightning_sdk.teamspace import ConnectionType
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class CloudAccountApi:
|
|
@@ -131,13 +132,20 @@ class CloudAccountApi:
|
|
|
131
132
|
)
|
|
132
133
|
return list(filtered_cloud_accounts)
|
|
133
134
|
|
|
134
|
-
def get_cloud_account_provider_mapping(self, teamspace_id: str) -> Dict["CloudProvider",
|
|
135
|
+
def get_cloud_account_provider_mapping(self, teamspace_id: str) -> Dict["CloudProvider", V1ExternalCluster]:
|
|
135
136
|
"""Gets the cloud account <-> provider mapping."""
|
|
136
|
-
res = self.
|
|
137
|
-
|
|
137
|
+
res = self.list_cloud_accounts(teamspace_id=teamspace_id)
|
|
138
|
+
cloud_accounts = {cloud_account.id: cloud_account for cloud_account in res}
|
|
139
|
+
providers = {cloud_account.id: self._get_cloud_account_provider(cloud_account) for cloud_account in res}
|
|
140
|
+
|
|
141
|
+
mapping = {}
|
|
142
|
+
for cloud_account_id, provider in providers.items():
|
|
143
|
+
if provider is not None:
|
|
144
|
+
mapping[provider] = cloud_accounts[cloud_account_id]
|
|
145
|
+
return mapping
|
|
138
146
|
|
|
139
147
|
@staticmethod
|
|
140
|
-
def _get_cloud_account_provider(cloud_account: Optional[V1ExternalCluster]) -> "CloudProvider":
|
|
148
|
+
def _get_cloud_account_provider(cloud_account: Optional[V1ExternalCluster]) -> Optional["CloudProvider"]:
|
|
141
149
|
"""Determines the cloud provider based on the cloud_account configuration.
|
|
142
150
|
|
|
143
151
|
Args:
|
|
@@ -165,14 +173,12 @@ class CloudAccountApi:
|
|
|
165
173
|
return CloudProvider.GCP
|
|
166
174
|
if cloud_account.spec.lambda_labs_v1:
|
|
167
175
|
return CloudProvider.LAMBDA_LABS
|
|
168
|
-
if cloud_account.spec.vultr_v1:
|
|
169
|
-
return CloudProvider.VULTR
|
|
170
176
|
if cloud_account.spec.voltage_park_v1:
|
|
171
177
|
return CloudProvider.VOLTAGE_PARK
|
|
172
178
|
if cloud_account.spec.nebius_v1:
|
|
173
179
|
return CloudProvider.NEBIUS
|
|
174
180
|
|
|
175
|
-
return
|
|
181
|
+
return None
|
|
176
182
|
|
|
177
183
|
def resolve_cloud_account(
|
|
178
184
|
self,
|
|
@@ -181,14 +187,19 @@ class CloudAccountApi:
|
|
|
181
187
|
cloud_provider: Optional[Union["CloudProvider", str]],
|
|
182
188
|
default_cloud_account: Optional[str],
|
|
183
189
|
) -> Optional[str]:
|
|
190
|
+
from lightning_sdk.machine import CloudProvider
|
|
191
|
+
|
|
192
|
+
if cloud_provider and not isinstance(cloud_provider, CloudProvider):
|
|
193
|
+
cloud_provider = CloudProvider(cloud_provider)
|
|
194
|
+
|
|
184
195
|
if cloud_account:
|
|
185
196
|
if cloud_provider:
|
|
186
197
|
cloud_account_resp = self.get_cloud_account_non_org(teamspace_id, cloud_account)
|
|
187
198
|
cloud_provider_resp = self._get_cloud_account_provider(cloud_account_resp)
|
|
188
199
|
if cloud_provider_resp != cloud_provider:
|
|
189
200
|
raise RuntimeError(
|
|
190
|
-
f"Specified both cloud_provider ({cloud_provider}) and "
|
|
191
|
-
"
|
|
201
|
+
f"Specified both cloud_provider ({cloud_provider}) and cloud_account ({cloud_account} "
|
|
202
|
+
f"has cloud provider {cloud_provider_resp}) which don't match!"
|
|
192
203
|
)
|
|
193
204
|
|
|
194
205
|
return cloud_account
|
|
@@ -196,9 +207,19 @@ class CloudAccountApi:
|
|
|
196
207
|
if cloud_provider:
|
|
197
208
|
cloud_account_mapping = self.get_cloud_account_provider_mapping(teamspace_id=teamspace_id)
|
|
198
209
|
if cloud_provider and cloud_provider in cloud_account_mapping:
|
|
199
|
-
return cloud_account_mapping[cloud_provider]
|
|
210
|
+
return cloud_account_mapping[cloud_provider].id
|
|
200
211
|
|
|
201
212
|
if default_cloud_account:
|
|
202
213
|
return default_cloud_account
|
|
203
214
|
|
|
204
215
|
return None
|
|
216
|
+
|
|
217
|
+
@staticmethod
|
|
218
|
+
def get_cloud_provider_for_connection_type(connection_type: "ConnectionType") -> "CloudProvider":
|
|
219
|
+
from lightning_sdk.machine import CloudProvider
|
|
220
|
+
from lightning_sdk.teamspace import ConnectionType
|
|
221
|
+
|
|
222
|
+
if connection_type == ConnectionType.EFS:
|
|
223
|
+
return CloudProvider.AWS
|
|
224
|
+
|
|
225
|
+
raise ValueError(f"ConnectionType {ConnectionType} currently not supported!")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from time import sleep
|
|
2
2
|
from typing import Any, Dict, List, Literal, Optional, Union
|
|
3
3
|
|
|
4
|
-
from lightning_sdk.api.utils import _machine_to_compute_name
|
|
4
|
+
from lightning_sdk.api.utils import _machine_to_compute_name, resolve_path_mappings
|
|
5
5
|
from lightning_sdk.lightning_cloud.openapi import (
|
|
6
6
|
CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs,
|
|
7
7
|
V1AutoscalingSpec,
|
|
@@ -58,6 +58,10 @@ class TokenAuth(Auth):
|
|
|
58
58
|
self.token = token
|
|
59
59
|
|
|
60
60
|
|
|
61
|
+
class ApiKeyAuth(Auth):
|
|
62
|
+
"""The ApiKeyAuth describes that the user requires a Lightning API Key to authenticate."""
|
|
63
|
+
|
|
64
|
+
|
|
61
65
|
class ReleaseStrategy:
|
|
62
66
|
"""The base class for release strategy."""
|
|
63
67
|
|
|
@@ -265,6 +269,7 @@ class DeploymentApi:
|
|
|
265
269
|
quantity: Optional[int] = None,
|
|
266
270
|
include_credentials: Optional[bool] = None,
|
|
267
271
|
max_runtime: Optional[int] = None,
|
|
272
|
+
path_mappings: Optional[Dict[str, str]] = None,
|
|
268
273
|
) -> V1Deployment:
|
|
269
274
|
# Update the deployment in place
|
|
270
275
|
|
|
@@ -284,6 +289,11 @@ class DeploymentApi:
|
|
|
284
289
|
requires_release = False
|
|
285
290
|
requires_release |= apply_change(deployment.spec, "image", image)
|
|
286
291
|
|
|
292
|
+
if path_mappings:
|
|
293
|
+
requires_release |= apply_change(
|
|
294
|
+
deployment.spec, "path_mappings", resolve_path_mappings(path_mappings, None, None)
|
|
295
|
+
)
|
|
296
|
+
|
|
287
297
|
requires_release |= apply_change(deployment.spec, "entrypoint", entrypoint)
|
|
288
298
|
requires_release |= apply_change(deployment.spec, "command", command)
|
|
289
299
|
requires_release |= apply_change(deployment.spec, "env", to_env(env))
|
|
@@ -300,6 +310,10 @@ class DeploymentApi:
|
|
|
300
310
|
if deployment.strategy is None:
|
|
301
311
|
raise RuntimeError("When doing a new release, a release strategy needs to be defined.")
|
|
302
312
|
|
|
313
|
+
# Force the deployment to make a new snapshot
|
|
314
|
+
if deployment.spec.cloudspace_id != "" and deployment.spec.run_id != "":
|
|
315
|
+
deployment.spec.run_id = ""
|
|
316
|
+
|
|
303
317
|
print("Some core arguments have changed. We are making a new release.")
|
|
304
318
|
|
|
305
319
|
apply_change(deployment.endpoint, "custom_domain", custom_domain)
|
|
@@ -371,11 +385,15 @@ def restore_auth(auth: Optional[V1EndpointAuth] = None) -> Optional[Auth]:
|
|
|
371
385
|
if not auth:
|
|
372
386
|
return None
|
|
373
387
|
|
|
388
|
+
if auth.user_api_key:
|
|
389
|
+
return ApiKeyAuth()
|
|
390
|
+
|
|
374
391
|
if auth.username and auth.password:
|
|
375
392
|
return BasicAuth(username=auth.username, password=auth.password)
|
|
376
393
|
|
|
377
394
|
if auth.token:
|
|
378
395
|
return TokenAuth(token=auth.token)
|
|
396
|
+
|
|
379
397
|
return None
|
|
380
398
|
|
|
381
399
|
|
|
@@ -512,6 +530,10 @@ def to_endpoint_auth(auth: Optional[Auth] = None) -> Optional[V1EndpointAuth]:
|
|
|
512
530
|
raise ValueError("The token should be defined.")
|
|
513
531
|
|
|
514
532
|
return V1EndpointAuth(enabled=True, token=auth.token)
|
|
533
|
+
|
|
534
|
+
if isinstance(auth, ApiKeyAuth):
|
|
535
|
+
return V1EndpointAuth(enabled=True, user_api_key=True)
|
|
536
|
+
|
|
515
537
|
return None
|
|
516
538
|
|
|
517
539
|
|
|
@@ -575,6 +597,7 @@ def to_spec(
|
|
|
575
597
|
cloudspace_id: Optional[None] = None,
|
|
576
598
|
max_runtime: Optional[int] = None,
|
|
577
599
|
machine_image_version: Optional[str] = None,
|
|
600
|
+
path_mappings: Optional[Dict[str, str]] = None,
|
|
578
601
|
) -> V1JobSpec:
|
|
579
602
|
if cloud_account is None:
|
|
580
603
|
raise ValueError("The cloud account should be defined.")
|
|
@@ -596,6 +619,8 @@ def to_spec(
|
|
|
596
619
|
if max_runtime:
|
|
597
620
|
optional_spec_kwargs["requested_run_duration_seconds"] = str(max_runtime)
|
|
598
621
|
|
|
622
|
+
path_mapping_list = resolve_path_mappings(path_mappings or {}, None, None)
|
|
623
|
+
|
|
599
624
|
return V1JobSpec(
|
|
600
625
|
cluster_id=cloud_account,
|
|
601
626
|
command=command,
|
|
@@ -609,6 +634,7 @@ def to_spec(
|
|
|
609
634
|
include_credentials=include_credentials,
|
|
610
635
|
cloudspace_id=cloudspace_id,
|
|
611
636
|
machine_image_version=machine_image_version,
|
|
637
|
+
path_mappings=path_mapping_list,
|
|
612
638
|
**optional_spec_kwargs,
|
|
613
639
|
)
|
|
614
640
|
|
lightning_sdk/api/job_api.py
CHANGED
|
@@ -104,22 +104,23 @@ class JobApiV1:
|
|
|
104
104
|
org_id=org_id,
|
|
105
105
|
)
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
identifiers = []
|
|
108
108
|
|
|
109
109
|
if user_requested_compute_config and user_requested_compute_config.name:
|
|
110
|
-
|
|
110
|
+
identifiers.append(user_requested_compute_config.name)
|
|
111
111
|
else:
|
|
112
|
-
|
|
112
|
+
identifiers.append(spec.compute_config.instance_type)
|
|
113
113
|
|
|
114
114
|
for accelerator in accelerators:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
for ident in identifiers:
|
|
116
|
+
if ident in (
|
|
117
|
+
accelerator.slug,
|
|
118
|
+
accelerator.slug_multi_cloud,
|
|
119
|
+
accelerator.instance_id,
|
|
120
|
+
):
|
|
121
|
+
return Machine._from_accelerator(accelerator)
|
|
121
122
|
|
|
122
|
-
return Machine.from_str(
|
|
123
|
+
return Machine.from_str(identifiers[0])
|
|
123
124
|
|
|
124
125
|
def _get_machines_for_cloud_account(
|
|
125
126
|
self, teamspace_id: str, cloud_account_id: str, org_id: str
|
|
@@ -249,6 +250,7 @@ class JobApiV2:
|
|
|
249
250
|
artifacts_local: Optional[str], # deprecated in favor of path_mappings
|
|
250
251
|
artifacts_remote: Optional[str], # deprecated in favor of path_mappings
|
|
251
252
|
max_runtime: Optional[int] = None,
|
|
253
|
+
reuse_snapshot: bool = True,
|
|
252
254
|
) -> V1Job:
|
|
253
255
|
body = self._create_job_body(
|
|
254
256
|
name=name,
|
|
@@ -266,6 +268,7 @@ class JobApiV2:
|
|
|
266
268
|
artifacts_local=artifacts_local,
|
|
267
269
|
artifacts_remote=artifacts_remote,
|
|
268
270
|
max_runtime=max_runtime,
|
|
271
|
+
reuse_snapshot=reuse_snapshot,
|
|
269
272
|
)
|
|
270
273
|
|
|
271
274
|
job: V1Job = self._client.jobs_service_create_job(project_id=teamspace_id, body=body)
|
|
@@ -287,6 +290,7 @@ class JobApiV2:
|
|
|
287
290
|
path_mappings: Optional[Dict[str, str]],
|
|
288
291
|
artifacts_local: Optional[str], # deprecated in favor of path_mappings
|
|
289
292
|
artifacts_remote: Optional[str], # deprecated in favor of path_mappings)
|
|
293
|
+
reuse_snapshot: bool,
|
|
290
294
|
max_runtime: Optional[int] = None,
|
|
291
295
|
machine_image_version: Optional[str] = None,
|
|
292
296
|
) -> ProjectIdJobsBody:
|
|
@@ -297,7 +301,7 @@ class JobApiV2:
|
|
|
297
301
|
|
|
298
302
|
instance_name = _machine_to_compute_name(machine)
|
|
299
303
|
|
|
300
|
-
run_id = __GLOBAL_LIGHTNING_UNIQUE_IDS_STORE__[studio_id] if studio_id is not None else ""
|
|
304
|
+
run_id = __GLOBAL_LIGHTNING_UNIQUE_IDS_STORE__[studio_id] if (studio_id is not None and reuse_snapshot) else ""
|
|
301
305
|
|
|
302
306
|
path_mappings_list = resolve_path_mappings(
|
|
303
307
|
mappings=path_mappings or {},
|
|
@@ -431,7 +435,7 @@ class JobApiV2:
|
|
|
431
435
|
if (spec.instance_name and spec.instance_name in possible_identifiers) or (
|
|
432
436
|
spec.instance_type and spec.instance_type in possible_identifiers
|
|
433
437
|
):
|
|
434
|
-
return Machine.
|
|
438
|
+
return Machine._from_accelerator(accelerator)
|
|
435
439
|
|
|
436
440
|
return Machine.from_str(spec.instance_name or spec.instance_type)
|
|
437
441
|
|
lightning_sdk/api/license_api.py
CHANGED
|
@@ -1,70 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
|
|
5
|
-
from lightning_sdk.lightning_cloud import env
|
|
6
|
-
from lightning_sdk.lightning_cloud.rest_client import LightningClient
|
|
7
|
-
|
|
8
|
-
LICENSE_CODE = os.environ.get("LICENSE_CODE", "d9s79g79ss")
|
|
9
|
-
# https://lightning.ai/home?settings=licenses
|
|
10
|
-
LICENSE_SIGNING_URL = f"{env.LIGHTNING_CLOUD_URL}?settings=licenses"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def generate_url_user_settings(name: str, redirect_to: str = LICENSE_SIGNING_URL) -> str:
|
|
14
|
-
params = urlencode({"redirectTo": redirect_to, "okbhrt": LICENSE_CODE, "licenseName": name})
|
|
15
|
-
return f"{env.LIGHTNING_CLOUD_URL}/sign-in?{params}"
|
|
1
|
+
from lightning_sdk.api.utils import _get_cloud_url as _cloud_url
|
|
2
|
+
from lightning_sdk.lightning_cloud.login import Auth
|
|
3
|
+
from lightning_sdk.lightning_cloud.openapi import LicenseKeyValidateBody, ProductLicenseServiceApi
|
|
16
4
|
|
|
17
5
|
|
|
18
6
|
class LicenseApi:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
self._client_public = LightningClient(retry=False, max_tries=0, with_auth=False)
|
|
26
|
-
return self._client_public
|
|
27
|
-
|
|
28
|
-
@property
|
|
29
|
-
def client_authenticated(self) -> LightningClient:
|
|
30
|
-
if not self._client_authenticated:
|
|
31
|
-
self._client_authenticated = LightningClient(retry=True, max_tries=3, with_auth=True)
|
|
32
|
-
return self._client_authenticated
|
|
7
|
+
def __init__(self, login_token: str) -> None:
|
|
8
|
+
self._cloud_url = _cloud_url()
|
|
9
|
+
self._auth = Auth()
|
|
10
|
+
self._auth.token_login(login_token, save_token=True)
|
|
11
|
+
self._client = self._auth.create_api_client()
|
|
12
|
+
self._api = ProductLicenseServiceApi(self._client)
|
|
33
13
|
|
|
34
|
-
def
|
|
35
|
-
|
|
36
|
-
license_key: str,
|
|
37
|
-
product_name: str,
|
|
38
|
-
product_version: Optional[str] = None,
|
|
39
|
-
product_type: str = "package",
|
|
40
|
-
) -> bool:
|
|
41
|
-
"""Check if the license key is valid.
|
|
14
|
+
def validate_license(self, license_key: str, product_id: str) -> bool:
|
|
15
|
+
"""Validate a license key for a specific product.
|
|
42
16
|
|
|
43
17
|
Args:
|
|
44
|
-
license_key: The license key to
|
|
45
|
-
|
|
46
|
-
product_version: The version of the product.
|
|
47
|
-
product_type: The type of the product. Default is "package".
|
|
18
|
+
license_key: The license key to validate
|
|
19
|
+
product_id: The product ID
|
|
48
20
|
|
|
49
21
|
Returns:
|
|
50
|
-
True if
|
|
51
|
-
"""
|
|
52
|
-
response = self.client_public.product_license_service_validate_product_license(
|
|
53
|
-
license_key=license_key,
|
|
54
|
-
product_name=product_name,
|
|
55
|
-
product_version=product_version,
|
|
56
|
-
product_type=product_type,
|
|
57
|
-
)
|
|
58
|
-
return response.valid
|
|
22
|
+
bool: True if license is valid, False otherwise
|
|
59
23
|
|
|
60
|
-
|
|
61
|
-
|
|
24
|
+
Raises:
|
|
25
|
+
Exception: If license validation fails
|
|
26
|
+
"""
|
|
27
|
+
try:
|
|
28
|
+
response = self._api.product_license_service_validate_license(
|
|
29
|
+
body=LicenseKeyValidateBody(product_id=product_id), license_key=license_key
|
|
30
|
+
)
|
|
31
|
+
return response.is_valid
|
|
32
|
+
except Exception:
|
|
33
|
+
raise InvalidLicenseError(f"Invalid license key {license_key} for product {product_id}") from None
|
|
62
34
|
|
|
63
|
-
Args:
|
|
64
|
-
user_id: The ID of the user.
|
|
65
35
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"""
|
|
69
|
-
response = self.client_authenticated.product_license_service_list_user_licenses(user_id=user_id)
|
|
70
|
-
return response.licenses
|
|
36
|
+
class InvalidLicenseError(Exception):
|
|
37
|
+
pass
|
lightning_sdk/api/llm_api.py
CHANGED
|
@@ -16,6 +16,7 @@ from lightning_sdk.lightning_cloud.login import Auth, AuthServer
|
|
|
16
16
|
from lightning_sdk.lightning_cloud.openapi.models import (
|
|
17
17
|
StreamResultOfV1ConversationResponseChunk,
|
|
18
18
|
V1ConversationResponseChunk,
|
|
19
|
+
V1ManagedModel,
|
|
19
20
|
V1ResponseChoice,
|
|
20
21
|
V1ResponseChoiceDelta,
|
|
21
22
|
)
|
|
@@ -67,13 +68,23 @@ def authenticate(model: str, shall_confirm: bool = True) -> None:
|
|
|
67
68
|
class LLMApi:
|
|
68
69
|
def __init__(self) -> None:
|
|
69
70
|
self._client = LightningClient(retry=False, max_tries=0)
|
|
71
|
+
self._assistant = None
|
|
72
|
+
self._model = None
|
|
70
73
|
|
|
71
74
|
def get_assistant(self, model_provider: str, model_name: str, user_name: str, org_name: str) -> str:
|
|
72
75
|
result = self._client.assistants_service_get_managed_model_assistant(
|
|
73
76
|
model_provider=model_provider, model_name=model_name, user_name=user_name, org_name=org_name
|
|
74
77
|
)
|
|
78
|
+
self._assistant = result
|
|
75
79
|
return result.id
|
|
76
80
|
|
|
81
|
+
def get_model_metadata(self, teamspace_id: str, model_name: str) -> V1ManagedModel:
|
|
82
|
+
if self._assistant and not self._model:
|
|
83
|
+
self._model = self._client.assistants_service_get_managed_model_by_name(
|
|
84
|
+
teamspace_id, self._assistant.managed_endpoint_id, model_name
|
|
85
|
+
)
|
|
86
|
+
return self._model
|
|
87
|
+
|
|
77
88
|
def _parse_stream_line(self, decoded_line: str) -> Optional[V1ConversationResponseChunk]:
|
|
78
89
|
try:
|
|
79
90
|
payload = json.loads(decoded_line)
|
|
@@ -132,6 +143,7 @@ class LLMApi:
|
|
|
132
143
|
metadata: Optional[Dict[str, str]] = None,
|
|
133
144
|
stream: bool = False,
|
|
134
145
|
tools: Optional[List[Dict[str, Any]]] = None,
|
|
146
|
+
reasoning_effort: Optional[str] = None,
|
|
135
147
|
**kwargs: Any,
|
|
136
148
|
) -> Union[V1ConversationResponseChunk, Generator[V1ConversationResponseChunk, None, None]]:
|
|
137
149
|
is_internal_conversation = os.getenv("LIGHTNING_INTERNAL_CONVERSATION", "false").lower() == "true"
|
|
@@ -146,7 +158,6 @@ class LLMApi:
|
|
|
146
158
|
{"contentType": "text", "parts": [prompt]},
|
|
147
159
|
],
|
|
148
160
|
},
|
|
149
|
-
"max_tokens": max_completion_tokens,
|
|
150
161
|
"conversation_id": conversation_id,
|
|
151
162
|
"billing_project_id": billing_project_id,
|
|
152
163
|
"name": name,
|
|
@@ -159,6 +170,12 @@ class LLMApi:
|
|
|
159
170
|
"parent_message_id": kwargs.get("parent_message_id", ""),
|
|
160
171
|
"tools": tools,
|
|
161
172
|
}
|
|
173
|
+
if max_completion_tokens is not None:
|
|
174
|
+
body["max_completion_tokens"] = max_completion_tokens
|
|
175
|
+
|
|
176
|
+
if reasoning_effort:
|
|
177
|
+
body["reasoning_effort"] = reasoning_effort
|
|
178
|
+
|
|
162
179
|
if images:
|
|
163
180
|
for image in images:
|
|
164
181
|
url = image
|
|
@@ -189,6 +206,7 @@ class LLMApi:
|
|
|
189
206
|
name: Optional[str] = None,
|
|
190
207
|
metadata: Optional[Dict[str, str]] = None,
|
|
191
208
|
stream: bool = False,
|
|
209
|
+
reasoning_effort: Optional[str] = None,
|
|
192
210
|
**kwargs: Any,
|
|
193
211
|
) -> Union[V1ConversationResponseChunk, AsyncGenerator[V1ConversationResponseChunk, None]]:
|
|
194
212
|
is_internal_conversation = os.getenv("LIGHTNING_INTERNAL_CONVERSATION", "false").lower() == "true"
|
|
@@ -203,7 +221,6 @@ class LLMApi:
|
|
|
203
221
|
{"contentType": "text", "parts": [prompt]},
|
|
204
222
|
],
|
|
205
223
|
},
|
|
206
|
-
"max_completion_tokens": max_completion_tokens,
|
|
207
224
|
"conversation_id": conversation_id,
|
|
208
225
|
"billing_project_id": billing_project_id,
|
|
209
226
|
"name": name,
|
|
@@ -216,6 +233,12 @@ class LLMApi:
|
|
|
216
233
|
"parent_message_id": kwargs.get("parent_message_id", ""),
|
|
217
234
|
"sent_at": datetime.datetime.now(datetime.timezone.utc).isoformat(timespec="microseconds"),
|
|
218
235
|
}
|
|
236
|
+
if max_completion_tokens is not None:
|
|
237
|
+
body["max_completion_tokens"] = max_completion_tokens
|
|
238
|
+
|
|
239
|
+
if reasoning_effort:
|
|
240
|
+
body["reasoning_effort"] = reasoning_effort
|
|
241
|
+
|
|
219
242
|
if images:
|
|
220
243
|
for image in images:
|
|
221
244
|
url = image
|
lightning_sdk/api/mmt_api.py
CHANGED
|
@@ -88,6 +88,7 @@ class MMTApiV2:
|
|
|
88
88
|
artifacts_local: Optional[str], # deprecated in favor of path_mappings
|
|
89
89
|
artifacts_remote: Optional[str], # deprecated in favor of path_mappings
|
|
90
90
|
max_runtime: Optional[int],
|
|
91
|
+
reuse_snapshot: bool,
|
|
91
92
|
) -> V1MultiMachineJob:
|
|
92
93
|
body = self._create_mmt_body(
|
|
93
94
|
name=name,
|
|
@@ -106,6 +107,7 @@ class MMTApiV2:
|
|
|
106
107
|
artifacts_local=artifacts_local, # deprecated in favor of path_mappings
|
|
107
108
|
artifacts_remote=artifacts_remote, # deprecated in favor of path_mappings
|
|
108
109
|
max_runtime=max_runtime,
|
|
110
|
+
reuse_snapshot=reuse_snapshot,
|
|
109
111
|
)
|
|
110
112
|
|
|
111
113
|
job: V1MultiMachineJob = self._client.jobs_service_create_multi_machine_job(project_id=teamspace_id, body=body)
|
|
@@ -128,6 +130,7 @@ class MMTApiV2:
|
|
|
128
130
|
path_mappings: Optional[Dict[str, str]],
|
|
129
131
|
artifacts_local: Optional[str], # deprecated in favor of path_mappings
|
|
130
132
|
artifacts_remote: Optional[str], # deprecated in favor of path_mappings
|
|
133
|
+
reuse_snapshot: bool,
|
|
131
134
|
max_runtime: Optional[int] = None,
|
|
132
135
|
machine_image_version: Optional[str] = None,
|
|
133
136
|
) -> ProjectIdMultimachinejobsBody:
|
|
@@ -138,7 +141,7 @@ class MMTApiV2:
|
|
|
138
141
|
|
|
139
142
|
instance_name = _machine_to_compute_name(machine)
|
|
140
143
|
|
|
141
|
-
run_id = __GLOBAL_LIGHTNING_UNIQUE_IDS_STORE__[studio_id] if studio_id is not None else ""
|
|
144
|
+
run_id = __GLOBAL_LIGHTNING_UNIQUE_IDS_STORE__[studio_id] if (studio_id is not None and reuse_snapshot) else ""
|
|
142
145
|
|
|
143
146
|
path_mappings_list = resolve_path_mappings(
|
|
144
147
|
mappings=path_mappings or {},
|
|
@@ -265,7 +268,7 @@ class MMTApiV2:
|
|
|
265
268
|
if (spec.instance_name and spec.instance_name in possible_identifiers) or (
|
|
266
269
|
spec.instance_type and spec.instance_type in possible_identifiers
|
|
267
270
|
):
|
|
268
|
-
return Machine.
|
|
271
|
+
return Machine._from_accelerator(accelerator)
|
|
269
272
|
|
|
270
273
|
return Machine.from_str(spec.instance_name or spec.instance_type)
|
|
271
274
|
|