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
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"""Studio startup/switch progress bar utilities."""
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
import types
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import Any, Callable, List, Optional, Type, Union
|
|
7
|
+
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.progress import BarColumn, Progress, SpinnerColumn, TaskID, TextColumn, TimeElapsedColumn
|
|
10
|
+
|
|
11
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_accelerator import V1ClusterAccelerator
|
|
12
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_status_response import (
|
|
13
|
+
V1GetCloudSpaceInstanceStatusResponse,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class StartupPhase(Enum):
|
|
18
|
+
"""Studio startup phase messages."""
|
|
19
|
+
|
|
20
|
+
STARTING_STUDIO = "Starting Studio..."
|
|
21
|
+
GETTING_MACHINE = "Getting a machine..."
|
|
22
|
+
|
|
23
|
+
SWITCHING_STUDIO = "Switching Studio..."
|
|
24
|
+
|
|
25
|
+
SETTING_UP_MACHINE = "Setting up machine..."
|
|
26
|
+
RESTORING_STUDIO = "Restoring Studio..."
|
|
27
|
+
PREPARING_STUDIO = "Preparing Studio..."
|
|
28
|
+
RESTORING_BASE_STUDIO = "Restoring Base Studio..."
|
|
29
|
+
SETTING_UP_BASE_STUDIO = "Setting up Base Studio..."
|
|
30
|
+
DONE = "Done"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def get_switching_progress_message(percentage: int, is_base_studio: bool) -> str:
|
|
34
|
+
"""Get progress message for switching studios."""
|
|
35
|
+
percentage = max(0, min(100, round(percentage)))
|
|
36
|
+
|
|
37
|
+
if percentage > 98:
|
|
38
|
+
message = StartupPhase.DONE.value
|
|
39
|
+
elif percentage > 80:
|
|
40
|
+
message = StartupPhase.RESTORING_BASE_STUDIO.value if is_base_studio else StartupPhase.RESTORING_STUDIO.value
|
|
41
|
+
elif percentage > 60:
|
|
42
|
+
message = StartupPhase.SETTING_UP_MACHINE.value
|
|
43
|
+
else:
|
|
44
|
+
message = StartupPhase.SWITCHING_STUDIO.value
|
|
45
|
+
return f"({percentage}%) {message}"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def estimated_studio_ready_in_seconds(
|
|
49
|
+
cloud_space: Any, cloud_space_instance_status: Any, accelerators: Optional[List[V1ClusterAccelerator]] = None
|
|
50
|
+
) -> int:
|
|
51
|
+
"""Calculate estimated seconds until studio is ready."""
|
|
52
|
+
# Default estimate
|
|
53
|
+
return 120
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def progress_bar_growth(default_timeout: int, counter: float) -> int:
|
|
57
|
+
"""Calculate progress bar growth based on timeout and counter."""
|
|
58
|
+
if default_timeout <= 0:
|
|
59
|
+
return 100
|
|
60
|
+
|
|
61
|
+
value = ((default_timeout - counter) / default_timeout) * 100
|
|
62
|
+
if value > 100:
|
|
63
|
+
value = 100
|
|
64
|
+
if value < 0:
|
|
65
|
+
value = 0
|
|
66
|
+
return int(value)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class StudioProgressTracker:
|
|
70
|
+
"""Tracks and displays progress for studio startup/switching operations."""
|
|
71
|
+
|
|
72
|
+
def __init__(self, operation_type: str = "start", show_progress: bool = True, check_interval: float = 1.0) -> None:
|
|
73
|
+
"""Initialize progress tracker.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
operation_type: Type of operation ('start' or 'switch')
|
|
77
|
+
show_progress: Whether to display progress bar
|
|
78
|
+
check_interval: Seconds between status checks
|
|
79
|
+
"""
|
|
80
|
+
self.operation_type = operation_type
|
|
81
|
+
self.show_progress = show_progress
|
|
82
|
+
self.check_interval = check_interval
|
|
83
|
+
self.progress: Optional[Progress] = None
|
|
84
|
+
self.task_id: Optional[TaskID] = None
|
|
85
|
+
self.console = Console()
|
|
86
|
+
self._last_message = ""
|
|
87
|
+
|
|
88
|
+
def __enter__(self) -> "StudioProgressTracker":
|
|
89
|
+
"""Enter context manager."""
|
|
90
|
+
if self.show_progress:
|
|
91
|
+
self.progress = Progress(
|
|
92
|
+
SpinnerColumn(),
|
|
93
|
+
TextColumn("[progress.description]{task.description}"),
|
|
94
|
+
BarColumn(),
|
|
95
|
+
TextColumn("[progress.percentage]{task.percentage:>3.0f}%"),
|
|
96
|
+
TimeElapsedColumn(),
|
|
97
|
+
console=self.console,
|
|
98
|
+
transient=False,
|
|
99
|
+
)
|
|
100
|
+
self.progress.start()
|
|
101
|
+
self.task_id = self.progress.add_task(f"{self.operation_type.capitalize()}ing Studio...", total=100)
|
|
102
|
+
return self
|
|
103
|
+
|
|
104
|
+
def __exit__(
|
|
105
|
+
self,
|
|
106
|
+
exc_type: Union[Type[BaseException], None],
|
|
107
|
+
exc_val: Union[BaseException, None],
|
|
108
|
+
exc_tb: Union[types.TracebackType, None],
|
|
109
|
+
) -> None:
|
|
110
|
+
"""Exit context manager."""
|
|
111
|
+
if self.progress:
|
|
112
|
+
self.progress.stop()
|
|
113
|
+
|
|
114
|
+
def update_progress(self, percentage: int, message: str = "", is_base_studio: bool = False) -> None:
|
|
115
|
+
"""Update progress bar with current percentage and message."""
|
|
116
|
+
if not self.progress or self.task_id is None:
|
|
117
|
+
return
|
|
118
|
+
|
|
119
|
+
if self.operation_type == "switch":
|
|
120
|
+
display_message = get_switching_progress_message(percentage, is_base_studio)
|
|
121
|
+
else:
|
|
122
|
+
display_message = message or f"{self.operation_type.capitalize()}ing Studio..."
|
|
123
|
+
|
|
124
|
+
# Update description if message changed
|
|
125
|
+
if display_message != self._last_message:
|
|
126
|
+
self.progress.update(self.task_id, description=display_message)
|
|
127
|
+
self._last_message = display_message
|
|
128
|
+
|
|
129
|
+
# Never show 100% until truly complete
|
|
130
|
+
completed = min(percentage, 98) if percentage < 100 else 100
|
|
131
|
+
self.progress.update(self.task_id, completed=completed)
|
|
132
|
+
|
|
133
|
+
# Force console refresh to ensure progress is visible
|
|
134
|
+
self.progress.refresh()
|
|
135
|
+
|
|
136
|
+
def complete(self, success_message: str = "") -> None:
|
|
137
|
+
"""Mark operation as complete."""
|
|
138
|
+
if self.progress and self.task_id is not None:
|
|
139
|
+
self.progress.update(self.task_id, completed=100, description=success_message or "Done")
|
|
140
|
+
|
|
141
|
+
def track_startup_phases(
|
|
142
|
+
self,
|
|
143
|
+
status_getter: Callable[[], V1GetCloudSpaceInstanceStatusResponse],
|
|
144
|
+
accelerators: Optional[List[V1ClusterAccelerator]] = None,
|
|
145
|
+
timeout: int = 600,
|
|
146
|
+
) -> None:
|
|
147
|
+
"""Track startup phases and update progress accordingly."""
|
|
148
|
+
start_time = time.time()
|
|
149
|
+
last_progress = 5
|
|
150
|
+
phase_start_times = {}
|
|
151
|
+
last_message_time = 0
|
|
152
|
+
message_stability_delay = 3.0 # Seconds to wait before changing message
|
|
153
|
+
|
|
154
|
+
# Show initial progress immediately
|
|
155
|
+
self.update_progress(5, StartupPhase.STARTING_STUDIO.value)
|
|
156
|
+
|
|
157
|
+
while True:
|
|
158
|
+
try:
|
|
159
|
+
status = status_getter()
|
|
160
|
+
elapsed = time.time() - start_time
|
|
161
|
+
|
|
162
|
+
# Default fallback progress based on time
|
|
163
|
+
time_based_progress = min(95, int((elapsed / timeout) * 100))
|
|
164
|
+
current_progress = max(last_progress, time_based_progress)
|
|
165
|
+
current_message = StartupPhase.STARTING_STUDIO.value
|
|
166
|
+
|
|
167
|
+
# Check if we have detailed status information
|
|
168
|
+
if hasattr(status, "in_use") and status.in_use:
|
|
169
|
+
in_use = status.in_use
|
|
170
|
+
|
|
171
|
+
# Check startup status for detailed phases
|
|
172
|
+
if hasattr(in_use, "startup_status") and in_use.startup_status:
|
|
173
|
+
startup_status = in_use.startup_status
|
|
174
|
+
|
|
175
|
+
# Check completion first
|
|
176
|
+
if (
|
|
177
|
+
hasattr(startup_status, "top_up_restore_finished")
|
|
178
|
+
and startup_status.top_up_restore_finished
|
|
179
|
+
):
|
|
180
|
+
self.complete(StartupPhase.DONE.value)
|
|
181
|
+
break
|
|
182
|
+
|
|
183
|
+
# Check other phases in descending priority
|
|
184
|
+
if (
|
|
185
|
+
hasattr(startup_status, "initial_restore_finished")
|
|
186
|
+
and startup_status.initial_restore_finished
|
|
187
|
+
):
|
|
188
|
+
current_progress = max(current_progress, 80)
|
|
189
|
+
current_message = StartupPhase.PREPARING_STUDIO.value
|
|
190
|
+
elif hasattr(startup_status, "container_ready") and startup_status.container_ready:
|
|
191
|
+
current_progress = max(current_progress, 60)
|
|
192
|
+
current_message = StartupPhase.SETTING_UP_MACHINE.value
|
|
193
|
+
elif hasattr(startup_status, "machine_ready") and startup_status.machine_ready:
|
|
194
|
+
current_progress = max(current_progress, 30)
|
|
195
|
+
current_message = StartupPhase.GETTING_MACHINE.value
|
|
196
|
+
|
|
197
|
+
# Check general phase information
|
|
198
|
+
if hasattr(in_use, "phase") and in_use.phase:
|
|
199
|
+
phase = in_use.phase
|
|
200
|
+
|
|
201
|
+
if phase == "CLOUD_SPACE_INSTANCE_STATE_RUNNING":
|
|
202
|
+
current_progress = max(current_progress, 80)
|
|
203
|
+
current_message = StartupPhase.SETTING_UP_MACHINE.value
|
|
204
|
+
elif phase == "CLOUD_SPACE_INSTANCE_STATE_PENDING":
|
|
205
|
+
# Track time in pending phase for smoother progress
|
|
206
|
+
if "pending" not in phase_start_times:
|
|
207
|
+
phase_start_times["pending"] = time.time()
|
|
208
|
+
|
|
209
|
+
pending_elapsed = time.time() - phase_start_times["pending"]
|
|
210
|
+
# Progress more smoothly through pending phase (10-60%)
|
|
211
|
+
pending_progress = 10 + min(50, int((pending_elapsed / 60) * 50))
|
|
212
|
+
current_progress = max(current_progress, pending_progress)
|
|
213
|
+
current_message = StartupPhase.GETTING_MACHINE.value
|
|
214
|
+
|
|
215
|
+
# Check for requested machine status (pre-allocation)
|
|
216
|
+
elif hasattr(status, "requested") and status.requested:
|
|
217
|
+
if "allocation" not in phase_start_times:
|
|
218
|
+
phase_start_times["allocation"] = time.time()
|
|
219
|
+
|
|
220
|
+
allocation_elapsed = time.time() - phase_start_times["allocation"]
|
|
221
|
+
# Progress through allocation phase (5-30%)
|
|
222
|
+
allocation_progress = 5 + min(25, int((allocation_elapsed / 30) * 25))
|
|
223
|
+
current_progress = max(current_progress, allocation_progress)
|
|
224
|
+
current_message = StartupPhase.GETTING_MACHINE.value
|
|
225
|
+
|
|
226
|
+
# Ensure progress never decreases and moves smoothly
|
|
227
|
+
if current_progress > last_progress:
|
|
228
|
+
# Smooth progress increases - don't jump too much at once
|
|
229
|
+
max_increment = 3 if current_progress - last_progress > 10 else current_progress - last_progress
|
|
230
|
+
current_progress = last_progress + max_increment
|
|
231
|
+
|
|
232
|
+
current_progress = min(98, current_progress) # Never show 100% until truly complete
|
|
233
|
+
|
|
234
|
+
# Only update message if enough time has passed since last message change
|
|
235
|
+
# or if this is the first message
|
|
236
|
+
current_time = time.time()
|
|
237
|
+
should_update_message = current_message != self._last_message and (
|
|
238
|
+
current_time - last_message_time >= message_stability_delay or last_message_time == 0
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
if should_update_message:
|
|
242
|
+
self.update_progress(current_progress, current_message)
|
|
243
|
+
last_message_time = current_time
|
|
244
|
+
else:
|
|
245
|
+
# Update progress but keep existing message
|
|
246
|
+
if self.progress and self.task_id is not None:
|
|
247
|
+
self.progress.update(self.task_id, completed=current_progress)
|
|
248
|
+
self.progress.refresh()
|
|
249
|
+
|
|
250
|
+
last_progress = current_progress
|
|
251
|
+
|
|
252
|
+
# Break if we timeout
|
|
253
|
+
if elapsed > timeout:
|
|
254
|
+
self.complete("Studio start may still be in progress...")
|
|
255
|
+
break
|
|
256
|
+
|
|
257
|
+
except Exception:
|
|
258
|
+
# Continue on API errors but still update progress
|
|
259
|
+
elapsed = time.time() - start_time
|
|
260
|
+
fallback_progress = min(95, max(last_progress, int((elapsed / timeout) * 100)))
|
|
261
|
+
|
|
262
|
+
# Only update message if enough time has passed
|
|
263
|
+
current_time = time.time()
|
|
264
|
+
should_update_message = StartupPhase.GETTING_MACHINE.value != self._last_message and (
|
|
265
|
+
current_time - last_message_time >= message_stability_delay or last_message_time == 0
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
if should_update_message:
|
|
269
|
+
self.update_progress(fallback_progress, StartupPhase.GETTING_MACHINE.value)
|
|
270
|
+
last_message_time = current_time
|
|
271
|
+
else:
|
|
272
|
+
# Update progress but keep existing message
|
|
273
|
+
if self.progress and self.task_id is not None:
|
|
274
|
+
self.progress.update(self.task_id, completed=fallback_progress)
|
|
275
|
+
self.progress.refresh()
|
|
276
|
+
|
|
277
|
+
last_progress = fallback_progress
|
|
278
|
+
|
|
279
|
+
if elapsed > timeout:
|
|
280
|
+
self.complete("Studio start may still be in progress...")
|
|
281
|
+
break
|
|
282
|
+
|
|
283
|
+
time.sleep(self.check_interval)
|
lightning_sdk/utils/resolve.py
CHANGED
|
@@ -66,10 +66,18 @@ def _resolve_deprecated_provider(
|
|
|
66
66
|
)
|
|
67
67
|
return provider
|
|
68
68
|
|
|
69
|
+
if cloud_provider is None:
|
|
70
|
+
from lightning_sdk.utils.config import Config, DefaultConfigKeys
|
|
71
|
+
|
|
72
|
+
config = Config()
|
|
73
|
+
cloud_provider = config.get_value(DefaultConfigKeys.cloud_provider)
|
|
74
|
+
|
|
69
75
|
return cloud_provider
|
|
70
76
|
|
|
71
77
|
|
|
72
|
-
def _resolve_deprecated_cluster(
|
|
78
|
+
def _resolve_deprecated_cluster(
|
|
79
|
+
cloud_account: Optional[str], cluster: Optional[str], current_cloud_account: Optional[str] = None
|
|
80
|
+
) -> Optional[str]:
|
|
73
81
|
if cluster is not None:
|
|
74
82
|
if cloud_account is not None:
|
|
75
83
|
raise ValueError(
|
|
@@ -84,12 +92,26 @@ def _resolve_deprecated_cluster(cloud_account: Optional[str], cluster: Optional[
|
|
|
84
92
|
)
|
|
85
93
|
return cluster
|
|
86
94
|
|
|
95
|
+
if cloud_account is None:
|
|
96
|
+
from lightning_sdk.utils.config import Config, DefaultConfigKeys
|
|
97
|
+
|
|
98
|
+
config = Config()
|
|
99
|
+
cloud_account = config.get_value(DefaultConfigKeys.cloud_account)
|
|
100
|
+
|
|
101
|
+
if cloud_account is None:
|
|
102
|
+
cloud_account = current_cloud_account
|
|
103
|
+
|
|
87
104
|
return cloud_account
|
|
88
105
|
|
|
89
106
|
|
|
90
107
|
def _resolve_org_name(name: Optional[str]) -> Optional[str]:
|
|
91
108
|
if name is None:
|
|
92
109
|
name = os.environ.get("LIGHTNING_ORG", "") or None
|
|
110
|
+
if name is None:
|
|
111
|
+
from lightning_sdk.utils.config import Config, DefaultConfigKeys
|
|
112
|
+
|
|
113
|
+
config = Config()
|
|
114
|
+
name = config.get_value(DefaultConfigKeys.organization)
|
|
93
115
|
return name
|
|
94
116
|
|
|
95
117
|
|
|
@@ -118,6 +140,11 @@ def _resolve_org(org: Optional[Union[str, "Organization"]]) -> Optional["Organiz
|
|
|
118
140
|
def _resolve_user_name(name: Optional[str]) -> Optional[str]:
|
|
119
141
|
if name is None:
|
|
120
142
|
name = os.environ.get("LIGHTNING_USERNAME", "") or None
|
|
143
|
+
if name is None:
|
|
144
|
+
from lightning_sdk.utils.config import Config, DefaultConfigKeys
|
|
145
|
+
|
|
146
|
+
config = Config()
|
|
147
|
+
name = config.get_value(DefaultConfigKeys.user)
|
|
121
148
|
return name
|
|
122
149
|
|
|
123
150
|
|
|
@@ -137,6 +164,11 @@ def _resolve_user(user: Optional[Union[str, "User"]]) -> Optional["User"]:
|
|
|
137
164
|
def _resolve_teamspace_name(name: Optional[str]) -> Optional[str]:
|
|
138
165
|
if name is None:
|
|
139
166
|
name = os.environ.get("LIGHTNING_TEAMSPACE", "") or None
|
|
167
|
+
if name is None:
|
|
168
|
+
from lightning_sdk.utils.config import Config, DefaultConfigKeys
|
|
169
|
+
|
|
170
|
+
config = Config()
|
|
171
|
+
name = config.get_value(DefaultConfigKeys.teamspace_name)
|
|
140
172
|
return name
|
|
141
173
|
|
|
142
174
|
|
|
@@ -165,10 +197,29 @@ def _resolve_teamspace(
|
|
|
165
197
|
return Teamspace(name=teamspace, org=org)
|
|
166
198
|
|
|
167
199
|
user = _resolve_user(user)
|
|
168
|
-
if user is None:
|
|
169
|
-
raise RuntimeError("Neither user nor org provided, but one of them needs to be provided")
|
|
170
200
|
|
|
171
|
-
|
|
201
|
+
# If still no user or org resolved, try config defaults
|
|
202
|
+
if user is None and org is None:
|
|
203
|
+
from lightning_sdk.utils.config import Config, DefaultConfigKeys
|
|
204
|
+
|
|
205
|
+
config = Config()
|
|
206
|
+
owner_type = config.get_value(DefaultConfigKeys.teamspace_owner_type)
|
|
207
|
+
owner_name = config.get_value(DefaultConfigKeys.teamspace_owner)
|
|
208
|
+
|
|
209
|
+
if owner_type and owner_name:
|
|
210
|
+
if owner_type.lower() == "organization":
|
|
211
|
+
org = _resolve_org(owner_name)
|
|
212
|
+
elif owner_type.lower() == "user":
|
|
213
|
+
user = _resolve_user(owner_name)
|
|
214
|
+
|
|
215
|
+
# Final resolution check
|
|
216
|
+
if org is not None:
|
|
217
|
+
return Teamspace(name=teamspace, org=org)
|
|
218
|
+
|
|
219
|
+
if user is not None:
|
|
220
|
+
return Teamspace(name=teamspace, user=user)
|
|
221
|
+
|
|
222
|
+
raise RuntimeError("Neither user nor org provided, but one of them needs to be provided")
|
|
172
223
|
|
|
173
224
|
|
|
174
225
|
def _get_organizations_for_authed_user() -> List["Organization"]:
|
|
@@ -198,12 +249,36 @@ def skip_studio_init() -> Generator[None, None, None]:
|
|
|
198
249
|
"""Skip studio init based on current runtime."""
|
|
199
250
|
from lightning_sdk.studio import Studio
|
|
200
251
|
|
|
201
|
-
prev_studio_init_state = Studio._skip_init
|
|
202
|
-
Studio._skip_init = True
|
|
252
|
+
prev_studio_init_state = getattr(Studio._skip_init, "value", False)
|
|
253
|
+
Studio._skip_init.value = True
|
|
254
|
+
|
|
255
|
+
yield
|
|
256
|
+
|
|
257
|
+
Studio._skip_init.value = prev_studio_init_state
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
@contextmanager
|
|
261
|
+
def skip_studio_setup() -> Generator[None, None, None]:
|
|
262
|
+
"""Skip studio setup based on current runtime."""
|
|
263
|
+
from lightning_sdk.studio import Studio
|
|
264
|
+
|
|
265
|
+
prev_studio_setup_state = getattr(Studio._skip_setup, "value", False)
|
|
266
|
+
Studio._skip_setup.value = True
|
|
267
|
+
|
|
268
|
+
yield
|
|
269
|
+
|
|
270
|
+
Studio._skip_setup.value = prev_studio_setup_state
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
@contextmanager
|
|
274
|
+
def prevent_refetch_studio(studio: "Studio") -> Generator[None, None, None]:
|
|
275
|
+
"""Prevent refetching the studio based on current runtime."""
|
|
276
|
+
prev_prevent_refetch_state = getattr(studio, "_prevent_refetch", False)
|
|
277
|
+
studio._prevent_refetch = True
|
|
203
278
|
|
|
204
279
|
yield
|
|
205
280
|
|
|
206
|
-
|
|
281
|
+
studio._prevent_refetch = prev_prevent_refetch_state
|
|
207
282
|
|
|
208
283
|
|
|
209
284
|
def _parse_model_and_version(name: str) -> Tuple[str, Optional[str]]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lightning_sdk
|
|
3
|
-
Version: 2025.
|
|
3
|
+
Version: 2025.11.5
|
|
4
4
|
Summary: SDK to develop using Lightning AI Studios
|
|
5
5
|
Author-email: Lightning-AI <justus@lightning.ai>
|
|
6
6
|
License: MIT License
|
|
@@ -39,6 +39,7 @@ Requires-Dist: docker
|
|
|
39
39
|
Requires-Dist: fastapi
|
|
40
40
|
Requires-Dist: packaging
|
|
41
41
|
Requires-Dist: pyjwt
|
|
42
|
+
Requires-Dist: pyyaml
|
|
42
43
|
Requires-Dist: requests
|
|
43
44
|
Requires-Dist: rich
|
|
44
45
|
Requires-Dist: simple-term-menu
|