lightning-sdk 2025.11.13.post0__py3-none-any.whl → 2025.11.24__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. lightning_sdk/__init__.py +2 -0
  2. lightning_sdk/__version__.py +1 -1
  3. lightning_sdk/api/__init__.py +2 -9
  4. lightning_sdk/api/k8s_api.py +105 -0
  5. lightning_sdk/api/studio_api.py +19 -0
  6. lightning_sdk/api/utils.py +19 -0
  7. lightning_sdk/exceptions.py +2 -0
  8. lightning_sdk/k8s_cluster.py +83 -0
  9. lightning_sdk/lightning_cloud/openapi/__init__.py +15 -0
  10. lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +134 -1
  11. lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +5 -1
  12. lightning_sdk/lightning_cloud/openapi/api/jobs_service_api.py +539 -2
  13. lightning_sdk/lightning_cloud/openapi/api/k8_s_cluster_service_api.py +114 -0
  14. lightning_sdk/lightning_cloud/openapi/api/markets_service_api.py +5 -1
  15. lightning_sdk/lightning_cloud/openapi/api/organizations_service_api.py +99 -2
  16. lightning_sdk/lightning_cloud/openapi/api/projects_service_api.py +5 -1
  17. lightning_sdk/lightning_cloud/openapi/models/__init__.py +15 -0
  18. lightning_sdk/lightning_cloud/openapi/models/cluster_id_metrics_body.py +29 -3
  19. lightning_sdk/lightning_cloud/openapi/models/deployments_deployment_id_body.py +149 -0
  20. lightning_sdk/lightning_cloud/openapi/models/id_content_body.py +123 -0
  21. lightning_sdk/lightning_cloud/openapi/models/job_id_systemmetrics_body.py +123 -0
  22. lightning_sdk/lightning_cloud/openapi/models/message_id_actions_body.py +27 -1
  23. lightning_sdk/lightning_cloud/openapi/models/projects_id_body.py +1 -27
  24. lightning_sdk/lightning_cloud/openapi/models/v1_aws_direct_v1.py +27 -1
  25. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_security_options.py +107 -3
  26. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_spec.py +53 -1
  27. lightning_sdk/lightning_cloud/openapi/models/v1_compute_cluster_machines.py +149 -0
  28. lightning_sdk/lightning_cloud/openapi/models/v1_compute_cluster_request.py +149 -0
  29. lightning_sdk/lightning_cloud/openapi/models/v1_create_project_request.py +1 -27
  30. lightning_sdk/lightning_cloud/openapi/models/v1_generic_job.py +305 -0
  31. lightning_sdk/lightning_cloud/openapi/models/v1_get_project_balance_response.py +27 -1
  32. lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_v1.py +27 -1
  33. lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_pod.py +435 -0
  34. lightning_sdk/lightning_cloud/openapi/models/v1_list_all_jobs_response.py +175 -0
  35. lightning_sdk/lightning_cloud/openapi/models/v1_list_jobs_sort_by.py +104 -0
  36. lightning_sdk/lightning_cloud/openapi/models/v1_list_jobs_sort_order.py +104 -0
  37. lightning_sdk/lightning_cloud/openapi/models/v1_list_kubernetes_pods_response.py +149 -0
  38. lightning_sdk/lightning_cloud/openapi/models/v1_list_pipelines_response.py +55 -3
  39. lightning_sdk/lightning_cloud/openapi/models/v1_machine_direct_v1.py +53 -1
  40. lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_request.py +27 -1
  41. lightning_sdk/lightning_cloud/openapi/models/v1_membership.py +1 -27
  42. lightning_sdk/lightning_cloud/openapi/models/v1_message.py +27 -1
  43. lightning_sdk/lightning_cloud/openapi/models/v1_message_action.py +27 -1
  44. lightning_sdk/lightning_cloud/openapi/models/v1_org_deployment_visibility.py +227 -0
  45. lightning_sdk/lightning_cloud/openapi/models/v1_pod_preemption_event.py +305 -0
  46. lightning_sdk/lightning_cloud/openapi/models/v1_project_membership.py +1 -27
  47. lightning_sdk/lightning_cloud/openapi/models/v1_project_settings.py +1 -27
  48. lightning_sdk/lightning_cloud/openapi/models/v1_report_job_system_metrics_response.py +97 -0
  49. lightning_sdk/lightning_cloud/openapi/models/v1_resource_visibility.py +27 -1
  50. lightning_sdk/lightning_cloud/openapi/models/v1_rule_resource.py +1 -0
  51. lightning_sdk/lightning_cloud/openapi/models/v1_update_conversation_message_content_response.py +123 -0
  52. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +133 -107
  53. lightning_sdk/lightning_cloud/openapi/models/v1_validate_storage_transfer_response.py +15 -15
  54. lightning_sdk/lightning_cloud/rest_client.py +2 -0
  55. lightning_sdk/studio.py +12 -0
  56. {lightning_sdk-2025.11.13.post0.dist-info → lightning_sdk-2025.11.24.dist-info}/METADATA +2 -1
  57. {lightning_sdk-2025.11.13.post0.dist-info → lightning_sdk-2025.11.24.dist-info}/RECORD +61 -43
  58. {lightning_sdk-2025.11.13.post0.dist-info → lightning_sdk-2025.11.24.dist-info}/LICENSE +0 -0
  59. {lightning_sdk-2025.11.13.post0.dist-info → lightning_sdk-2025.11.24.dist-info}/WHEEL +0 -0
  60. {lightning_sdk-2025.11.13.post0.dist-info → lightning_sdk-2025.11.24.dist-info}/entry_points.txt +0 -0
  61. {lightning_sdk-2025.11.13.post0.dist-info → lightning_sdk-2025.11.24.dist-info}/top_level.txt +0 -0
lightning_sdk/__init__.py CHANGED
@@ -5,6 +5,7 @@ from lightning_sdk.constants import __GLOBAL_LIGHTNING_UNIQUE_IDS_STORE__ # noq
5
5
  from lightning_sdk.deployment import Deployment
6
6
  from lightning_sdk.helpers import VersionChecker, set_tqdm_envvars_noninteractive
7
7
  from lightning_sdk.job import Job
8
+ from lightning_sdk.k8s_cluster import K8sCluster
8
9
  from lightning_sdk.machine import CloudProvider, Machine
9
10
  from lightning_sdk.mmt import MMT
10
11
  from lightning_sdk.organization import Organization
@@ -19,6 +20,7 @@ __all__ = [
19
20
  "VM",
20
21
  "AIHub",
21
22
  "Agent",
23
+ "K8sCluster",
22
24
  "CloudProvider",
23
25
  "ConnectionType",
24
26
  "Deployment",
@@ -1,3 +1,3 @@
1
1
  """Version information for lightning_sdk."""
2
2
 
3
- __version__ = "2025.11.13post0"
3
+ __version__ = "2025.11.24"
@@ -1,17 +1,10 @@
1
1
  from lightning_sdk.api.agents_api import AgentApi
2
2
  from lightning_sdk.api.ai_hub_api import AIHubApi
3
3
  from lightning_sdk.api.cloud_account_api import CloudAccountApi
4
+ from lightning_sdk.api.k8s_api import K8sClusterApi
4
5
  from lightning_sdk.api.org_api import OrgApi
5
6
  from lightning_sdk.api.studio_api import StudioApi
6
7
  from lightning_sdk.api.teamspace_api import TeamspaceApi
7
8
  from lightning_sdk.api.user_api import UserApi
8
9
 
9
- __all__ = [
10
- "OrgApi",
11
- "StudioApi",
12
- "TeamspaceApi",
13
- "UserApi",
14
- "AgentApi",
15
- "AIHubApi",
16
- "CloudAccountApi",
17
- ]
10
+ __all__ = ["OrgApi", "StudioApi", "TeamspaceApi", "UserApi", "AgentApi", "AIHubApi", "CloudAccountApi", "K8sClusterApi"]
@@ -0,0 +1,105 @@
1
+ import json
2
+ import logging
3
+ from typing import Any, Dict, TypedDict, Union
4
+
5
+ import pandas as pd
6
+
7
+ from lightning_sdk.api.utils import ApiException
8
+ from lightning_sdk.lightning_cloud.rest_client import LightningClient
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+
13
+ class K8sClusterApiError(Exception):
14
+ """Custom exception for K8sClusterApi errors."""
15
+
16
+
17
+ class RowData(TypedDict):
18
+ num_allocated_gpus: int
19
+ num_requested_gpus: int
20
+ num_gpus: int
21
+
22
+
23
+ def _calculate_billed_k8s_gpus(row: RowData) -> int:
24
+ """Calculate the number of GPUs to be billed based on the given row data.
25
+
26
+ The function determines the billed GPUs using the following logic:
27
+ 1. If the number of allocated GPUs (`num_allocated_gpus`) is greater than 0,
28
+ it returns the allocated GPUs.
29
+ 2. If the number of requested GPUs (`num_requested_gpus`) exceeds the available GPUs (`num_gpus`),
30
+ it returns the available GPUs.
31
+ 3. Otherwise, it returns the number of requested GPUs.
32
+
33
+ Returns:
34
+ int: The number of GPUs to be billed.
35
+ """
36
+ if row["num_allocated_gpus"] > 0:
37
+ return row["num_allocated_gpus"] # Use allocated GPUs if available
38
+ if row["num_requested_gpus"] > row["num_gpus"]:
39
+ return row["num_gpus"] # Use available GPUs if requested exceeds available
40
+ return row["num_requested_gpus"] # Otherwise, use requested GPUs
41
+
42
+
43
+ class K8sClusterApi:
44
+ """Internal API client for API requests to k8s endpoints."""
45
+
46
+ def __init__(self, cloud_account: str) -> None:
47
+ self.cloud_account = cloud_account
48
+ self._client = LightningClient(max_tries=7)
49
+
50
+ def _parse_request_failure_body(self, e: ApiException) -> str:
51
+ """Parses the failure body from an ApiException.
52
+
53
+ Args:
54
+ e: The ApiException instance.
55
+
56
+ Returns:
57
+ The parsed failure body as a string.
58
+ """
59
+ try:
60
+ if e.body:
61
+ return json.loads(e.body)["message"]
62
+ return "No additional error information provided."
63
+ except Exception:
64
+ return str(e.reason)
65
+
66
+ def get_billing_usage(self, print_data: bool = False, **kwargs: Dict[str, Any]) -> Union[pd.DataFrame, pd.Series]:
67
+ """Gets the k8s usage metrics.
68
+
69
+ Returns:
70
+ The k8s usage metrics as a DataFrame or Series.
71
+ """
72
+ try:
73
+ response = self._client.k8_s_cluster_service_list_cluster_metrics(self.cloud_account, **kwargs)
74
+ cluster_metrics = [entry.to_dict() for entry in response.cluster_metrics]
75
+
76
+ df = pd.DataFrame.from_records(cluster_metrics)
77
+ if df.empty:
78
+ return df
79
+
80
+ df["hour"] = pd.to_datetime(df["timestamp"]).dt.floor("h")
81
+
82
+ # Calculate the mean of num_allocated_gpus for each hour
83
+ aggregated = df.groupby("hour", as_index=False)["num_allocated_gpus"].mean()
84
+ # Merge the aggregated values back into the original DataFrame
85
+ df = df.merge(aggregated, on="hour", suffixes=("", "_mean"))
86
+
87
+ # Replace the original num_allocated_gpus with the mean values
88
+ df["num_allocated_gpus"] = df["num_allocated_gpus_mean"]
89
+
90
+ # We group the data by hour and take the first occurrence to avoid duplicates
91
+ df = df.drop_duplicates(subset="hour", keep="first")
92
+
93
+ # Convert timestamp to hourly floor and rename columns
94
+ df["billed_gpus"] = df.apply(_calculate_billed_k8s_gpus, axis=1)
95
+
96
+ # Keep only the required columns
97
+ df = df[["hour", "num_gpus", "num_requested_gpus", "num_allocated_gpus", "billed_gpus"]]
98
+ if print_data:
99
+ with pd.option_context("display.max_rows", None, "display.max_columns", None):
100
+ print(df)
101
+ return df
102
+ except ApiException as e:
103
+ msg = self._parse_request_failure_body(e)
104
+ logger.error(f"Failed to retrieve Kubernetes usage data: {msg}")
105
+ raise K8sClusterApiError(msg) from e
@@ -411,6 +411,25 @@ class StudioApi:
411
411
 
412
412
  progress.complete("Machine switch completed successfully")
413
413
 
414
+ def machine_has_capacity(self, machine: Machine, teamspace_id: str, cloud_account_id: str, org_id: str) -> bool:
415
+ """Check capacity of the requested machine."""
416
+ accelerators = self._get_machines_for_cloud_account(
417
+ teamspace_id=teamspace_id, cloud_account_id=cloud_account_id, org_id=org_id
418
+ )
419
+
420
+ for accelerator in accelerators:
421
+ if accelerator.accelerator_type == "GPU":
422
+ accelerator_resources_count = accelerator.resources.gpu
423
+ else:
424
+ accelerator_resources_count = accelerator.resources.cpu
425
+ if (
426
+ machine.accelerator_count == accelerator_resources_count
427
+ and machine.family == accelerator.family
428
+ and accelerator.out_of_capacity
429
+ ):
430
+ return False
431
+ return True
432
+
414
433
  def get_machine(self, studio_id: str, teamspace_id: str, cloud_account_id: str, org_id: str) -> Machine:
415
434
  """Get the current machine type the given Studio is running on."""
416
435
  response: V1CloudSpaceInstanceConfig = self._client.cloud_space_service_get_cloud_space_instance_config(
@@ -4,6 +4,7 @@ import math
4
4
  import os
5
5
  import re
6
6
  from concurrent.futures import ThreadPoolExecutor
7
+ from datetime import datetime, timezone
7
8
  from enum import Enum
8
9
  from functools import lru_cache, partial
9
10
  from pathlib import Path
@@ -804,3 +805,21 @@ def raise_access_error_if_not_allowed(resource_type: AccessibleResource, teamspa
804
805
  f"Access to {resource_type.name} has been disabled for this teamspace. "
805
806
  "Contact a teamspace administrator to enable it."
806
807
  )
808
+
809
+
810
+ def to_iso_z(dt: datetime) -> str:
811
+ """Convert a datetime object to an ISO 8601 formatted string with UTC timezone (Z).
812
+
813
+ This function takes a datetime object, converts it to UTC timezone, formats it
814
+ to include milliseconds, and replaces the UTC offset with 'Z' to indicate UTC.
815
+
816
+ Args:
817
+ dt (datetime): The datetime object to be converted.
818
+
819
+ Returns:
820
+ str: The ISO 8601 formatted string in UTC timezone.
821
+ """
822
+ if dt.tzinfo is None:
823
+ dt = dt.replace(tzinfo=timezone.utc)
824
+ return dt.astimezone(timezone.utc).isoformat(timespec="milliseconds")
825
+ return dt.isoformat(timespec="milliseconds")
@@ -0,0 +1,2 @@
1
+ class OutOfCapacityError(RuntimeError):
2
+ """Raised when the requested machine is not available in the selected cloud account."""
@@ -0,0 +1,83 @@
1
+ from dataclasses import dataclass
2
+ from datetime import datetime
3
+ from typing import List, Optional
4
+
5
+ import pandas as pd
6
+
7
+ from lightning_sdk.api.k8s_api import K8sClusterApi
8
+ from lightning_sdk.api.utils import to_iso_z
9
+
10
+
11
+ @dataclass
12
+ class HourlyUsage:
13
+ time: datetime
14
+ available_gpus: int
15
+ billed_gpus: int
16
+
17
+
18
+ @dataclass
19
+ class K8sUsageResponse:
20
+ hours: List[HourlyUsage]
21
+ total_usage: float
22
+
23
+
24
+ class K8sCluster:
25
+ """A class to interact with the k8s API and retrieve usage-related information.
26
+
27
+ Methods:
28
+ -------
29
+ get_k8s_usage(account_cloud: str)
30
+ Retrieves Kubernetes usage information for a given cloud account.
31
+ """
32
+
33
+ def __init__(self, cloud_account: str) -> None:
34
+ self._cloud_account = cloud_account
35
+ self._k8s_cluster = K8sClusterApi(cloud_account=cloud_account)
36
+
37
+ def _convert_to_k8s_usage_response(self, df: pd.DataFrame) -> K8sUsageResponse:
38
+ """Converts a DataFrame to K8sUsageResponse.
39
+
40
+ Args:
41
+ df (pd.DataFrame): The DataFrame containing GPU usage data.
42
+
43
+ Returns:
44
+ K8sUsageResponse: The converted response containing hourly usage and total usage.
45
+ """
46
+ if df.empty:
47
+ return K8sUsageResponse(hours=[], total_usage=0.0)
48
+ # Convert each row of the DataFrame to HourlyUsage
49
+ hourly_usage_list: List[HourlyUsage] = [
50
+ HourlyUsage(time=row["hour"], available_gpus=row["num_gpus"], billed_gpus=row["billed_gpus"])
51
+ for _, row in df.iterrows()
52
+ ]
53
+
54
+ # Calculate total usage (sum of billed GPUs)
55
+ total_usage = df["billed_gpus"].sum()
56
+
57
+ # Create and return the K8sUsageResponse
58
+ return K8sUsageResponse(hours=hourly_usage_list, total_usage=total_usage)
59
+
60
+ def get_billing_usage(
61
+ self,
62
+ start_date: Optional[datetime] = None,
63
+ end_date: Optional[datetime] = None,
64
+ print_data: bool = False,
65
+ ) -> K8sUsageResponse:
66
+ """Gets the k8s usage metrics.
67
+
68
+ Args:
69
+ cloud_account: The cloud account to get usage for
70
+ start_date: The UTC start date for the usage period (optional)
71
+ end_date: The UTC end date for the usage period (optional)
72
+
73
+ Returns:
74
+ K8sUsageResponse: The Kubernetes usage response containing hourly usage and total usage.
75
+ """
76
+ k8s_args = {}
77
+ if start_date is not None:
78
+ k8s_args["start"] = to_iso_z(start_date)
79
+ if end_date is not None:
80
+ k8s_args["end"] = to_iso_z(end_date)
81
+ return self._convert_to_k8s_usage_response(
82
+ self._k8s_cluster.get_billing_usage(print_data=print_data, **k8s_args)
83
+ )
@@ -120,6 +120,7 @@ from lightning_sdk.lightning_cloud.openapi.models.dataset_id_visibility_body imp
120
120
  from lightning_sdk.lightning_cloud.openapi.models.datasets_id_body import DatasetsIdBody
121
121
  from lightning_sdk.lightning_cloud.openapi.models.deployment_id_alertingpolicies_body import DeploymentIdAlertingpoliciesBody
122
122
  from lightning_sdk.lightning_cloud.openapi.models.deployment_id_alertingpolicies_body1 import DeploymentIdAlertingpoliciesBody1
123
+ from lightning_sdk.lightning_cloud.openapi.models.deployments_deployment_id_body import DeploymentsDeploymentIdBody
123
124
  from lightning_sdk.lightning_cloud.openapi.models.deployments_id_body import DeploymentsIdBody
124
125
  from lightning_sdk.lightning_cloud.openapi.models.deploymenttemplates_id_body import DeploymenttemplatesIdBody
125
126
  from lightning_sdk.lightning_cloud.openapi.models.endpoints_id_body import EndpointsIdBody
@@ -135,6 +136,7 @@ from lightning_sdk.lightning_cloud.openapi.models.id_artifacts_body import IdArt
135
136
  from lightning_sdk.lightning_cloud.openapi.models.id_codeconfig_body import IdCodeconfigBody
136
137
  from lightning_sdk.lightning_cloud.openapi.models.id_collaborate_body import IdCollaborateBody
137
138
  from lightning_sdk.lightning_cloud.openapi.models.id_contactowner_body import IdContactownerBody
139
+ from lightning_sdk.lightning_cloud.openapi.models.id_content_body import IdContentBody
138
140
  from lightning_sdk.lightning_cloud.openapi.models.id_engage_body import IdEngageBody
139
141
  from lightning_sdk.lightning_cloud.openapi.models.id_engage_body1 import IdEngageBody1
140
142
  from lightning_sdk.lightning_cloud.openapi.models.id_execute_body import IdExecuteBody
@@ -164,6 +166,7 @@ from lightning_sdk.lightning_cloud.openapi.models.id_visibility_body2 import IdV
164
166
  from lightning_sdk.lightning_cloud.openapi.models.incident_id_messages_body import IncidentIdMessagesBody
165
167
  from lightning_sdk.lightning_cloud.openapi.models.incidents_id_body import IncidentsIdBody
166
168
  from lightning_sdk.lightning_cloud.openapi.models.job_id_reportroutingtelemetry_body import JobIdReportroutingtelemetryBody
169
+ from lightning_sdk.lightning_cloud.openapi.models.job_id_systemmetrics_body import JobIdSystemmetricsBody
167
170
  from lightning_sdk.lightning_cloud.openapi.models.jobs_id_body import JobsIdBody
168
171
  from lightning_sdk.lightning_cloud.openapi.models.jobs_id_body1 import JobsIdBody1
169
172
  from lightning_sdk.lightning_cloud.openapi.models.jobs_id_body2 import JobsIdBody2
@@ -372,6 +375,8 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_complete_upload import V1Co
372
375
  from lightning_sdk.lightning_cloud.openapi.models.v1_complete_upload_project_artifact_response import V1CompleteUploadProjectArtifactResponse
373
376
  from lightning_sdk.lightning_cloud.openapi.models.v1_complete_upload_temporary_artifact_request import V1CompleteUploadTemporaryArtifactRequest
374
377
  from lightning_sdk.lightning_cloud.openapi.models.v1_completed_part import V1CompletedPart
378
+ from lightning_sdk.lightning_cloud.openapi.models.v1_compute_cluster_machines import V1ComputeClusterMachines
379
+ from lightning_sdk.lightning_cloud.openapi.models.v1_compute_cluster_request import V1ComputeClusterRequest
375
380
  from lightning_sdk.lightning_cloud.openapi.models.v1_compute_config import V1ComputeConfig
376
381
  from lightning_sdk.lightning_cloud.openapi.models.v1_contact_assistant_owner_reason import V1ContactAssistantOwnerReason
377
382
  from lightning_sdk.lightning_cloud.openapi.models.v1_contact_assistant_owner_response import V1ContactAssistantOwnerResponse
@@ -573,6 +578,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_gcp_data_connection import
573
578
  from lightning_sdk.lightning_cloud.openapi.models.v1_gcp_data_connection_setup import V1GcpDataConnectionSetup
574
579
  from lightning_sdk.lightning_cloud.openapi.models.v1_ge_list_deployment_routing_telemetry_response import V1GeListDeploymentRoutingTelemetryResponse
575
580
  from lightning_sdk.lightning_cloud.openapi.models.v1_generate_ssh_key_pair_request import V1GenerateSSHKeyPairRequest
581
+ from lightning_sdk.lightning_cloud.openapi.models.v1_generic_job import V1GenericJob
576
582
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_affiliate_link_response import V1GetAffiliateLinkResponse
577
583
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_env_response import V1GetAgentJobEnvResponse
578
584
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_logs_metadata_response import V1GetAgentJobLogsMetadataResponse
@@ -671,6 +677,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_aws_config impor
671
677
  from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_direct_settings_v1 import V1KubernetesDirectSettingsV1
672
678
  from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_direct_v1 import V1KubernetesDirectV1
673
679
  from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_direct_v1_status import V1KubernetesDirectV1Status
680
+ from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_pod import V1KubernetesPod
674
681
  from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_template import V1KubernetesTemplate
675
682
  from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_template_property import V1KubernetesTemplateProperty
676
683
  from lightning_sdk.lightning_cloud.openapi.models.v1_lambda_labs_direct_v1 import V1LambdaLabsDirectV1
@@ -699,6 +706,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_list_affiliate_links_respon
699
706
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_agent_job_artifacts_response import V1ListAgentJobArtifactsResponse
700
707
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_agent_jobs_response import V1ListAgentJobsResponse
701
708
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_aggregated_pod_metrics_response import V1ListAggregatedPodMetricsResponse
709
+ from lightning_sdk.lightning_cloud.openapi.models.v1_list_all_jobs_response import V1ListAllJobsResponse
702
710
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_assistants_response import V1ListAssistantsResponse
703
711
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_blog_posts_response import V1ListBlogPostsResponse
704
712
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_cloud_space_apps_response import V1ListCloudSpaceAppsResponse
@@ -757,8 +765,11 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_list_incidents_response imp
757
765
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_job_files_response import V1ListJobFilesResponse
758
766
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_job_resources_response import V1ListJobResourcesResponse
759
767
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_jobs_response import V1ListJobsResponse
768
+ from lightning_sdk.lightning_cloud.openapi.models.v1_list_jobs_sort_by import V1ListJobsSortBy
769
+ from lightning_sdk.lightning_cloud.openapi.models.v1_list_jobs_sort_order import V1ListJobsSortOrder
760
770
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_joinable_organizations_response import V1ListJoinableOrganizationsResponse
761
771
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_kai_scheduler_queues_metrics_response import V1ListKaiSchedulerQueuesMetricsResponse
772
+ from lightning_sdk.lightning_cloud.openapi.models.v1_list_kubernetes_pods_response import V1ListKubernetesPodsResponse
762
773
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_kubernetes_templates_response import V1ListKubernetesTemplatesResponse
763
774
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_license_response import V1ListLicenseResponse
764
775
  from lightning_sdk.lightning_cloud.openapi.models.v1_list_lightning_run_response import V1ListLightningRunResponse
@@ -877,6 +888,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_notification_preferences_re
877
888
  from lightning_sdk.lightning_cloud.openapi.models.v1_notification_type import V1NotificationType
878
889
  from lightning_sdk.lightning_cloud.openapi.models.v1_onboarding_event_request import V1OnboardingEventRequest
879
890
  from lightning_sdk.lightning_cloud.openapi.models.v1_onboarding_event_response import V1OnboardingEventResponse
891
+ from lightning_sdk.lightning_cloud.openapi.models.v1_org_deployment_visibility import V1OrgDeploymentVisibility
880
892
  from lightning_sdk.lightning_cloud.openapi.models.v1_org_member import V1OrgMember
881
893
  from lightning_sdk.lightning_cloud.openapi.models.v1_org_membership import V1OrgMembership
882
894
  from lightning_sdk.lightning_cloud.openapi.models.v1_org_membership_role_binding import V1OrgMembershipRoleBinding
@@ -904,6 +916,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_platform_notification impor
904
916
  from lightning_sdk.lightning_cloud.openapi.models.v1_plugin import V1Plugin
905
917
  from lightning_sdk.lightning_cloud.openapi.models.v1_plugins_list_response import V1PluginsListResponse
906
918
  from lightning_sdk.lightning_cloud.openapi.models.v1_pod_metrics import V1PodMetrics
919
+ from lightning_sdk.lightning_cloud.openapi.models.v1_pod_preemption_event import V1PodPreemptionEvent
907
920
  from lightning_sdk.lightning_cloud.openapi.models.v1_post_cloud_space_artifact_events_response import V1PostCloudSpaceArtifactEventsResponse
908
921
  from lightning_sdk.lightning_cloud.openapi.models.v1_presigned_url import V1PresignedUrl
909
922
  from lightning_sdk.lightning_cloud.openapi.models.v1_profiler_capture import V1ProfilerCapture
@@ -946,6 +959,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_render_kubernetes_template_
946
959
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_cloud_space_instance_stop_at_response import V1ReportCloudSpaceInstanceStopAtResponse
947
960
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_cloud_space_instance_system_metrics_response import V1ReportCloudSpaceInstanceSystemMetricsResponse
948
961
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_deployment_routing_telemetry_response import V1ReportDeploymentRoutingTelemetryResponse
962
+ from lightning_sdk.lightning_cloud.openapi.models.v1_report_job_system_metrics_response import V1ReportJobSystemMetricsResponse
949
963
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_k8s_cluster_metrics_response import V1ReportK8sClusterMetricsResponse
950
964
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_logs_activity_response import V1ReportLogsActivityResponse
951
965
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_restart_timings_response import V1ReportRestartTimingsResponse
@@ -1054,6 +1068,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators
1054
1068
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_response import V1UpdateClusterAcceleratorsResponse
1055
1069
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_availability_request import V1UpdateClusterAvailabilityRequest
1056
1070
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_like_response import V1UpdateConversationLikeResponse
1071
+ from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_message_content_response import V1UpdateConversationMessageContentResponse
1057
1072
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_message_like_response import V1UpdateConversationMessageLikeResponse
1058
1073
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_deployment_visibility_response import V1UpdateDeploymentVisibilityResponse
1059
1074
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_index_response import V1UpdateIndexResponse
@@ -2007,6 +2007,7 @@ class AssistantsServiceApi(object):
2007
2007
  :param str conversation_id: (required)
2008
2008
  :param str message_id: (required)
2009
2009
  :param str project_id:
2010
+ :param str cloudspace_id:
2010
2011
  :return: V1ListConversationMessageActionsResponse
2011
2012
  If the method is called asynchronously,
2012
2013
  returns the request thread.
@@ -2031,12 +2032,13 @@ class AssistantsServiceApi(object):
2031
2032
  :param str conversation_id: (required)
2032
2033
  :param str message_id: (required)
2033
2034
  :param str project_id:
2035
+ :param str cloudspace_id:
2034
2036
  :return: V1ListConversationMessageActionsResponse
2035
2037
  If the method is called asynchronously,
2036
2038
  returns the request thread.
2037
2039
  """
2038
2040
 
2039
- all_params = ['assistant_id', 'conversation_id', 'message_id', 'project_id'] # noqa: E501
2041
+ all_params = ['assistant_id', 'conversation_id', 'message_id', 'project_id', 'cloudspace_id'] # noqa: E501
2040
2042
  all_params.append('async_req')
2041
2043
  all_params.append('_return_http_data_only')
2042
2044
  all_params.append('_preload_content')
@@ -2077,6 +2079,8 @@ class AssistantsServiceApi(object):
2077
2079
  query_params = []
2078
2080
  if 'project_id' in params:
2079
2081
  query_params.append(('projectId', params['project_id'])) # noqa: E501
2082
+ if 'cloudspace_id' in params:
2083
+ query_params.append(('cloudspaceId', params['cloudspace_id'])) # noqa: E501
2080
2084
 
2081
2085
  header_params = {}
2082
2086
 
@@ -2983,6 +2987,135 @@ class AssistantsServiceApi(object):
2983
2987
  _request_timeout=params.get('_request_timeout'),
2984
2988
  collection_formats=collection_formats)
2985
2989
 
2990
+ def assistants_service_update_conversation_message_content(self, body: 'IdContentBody', project_id: 'str', assistant_id: 'str', conversation_id: 'str', id: 'str', **kwargs) -> 'V1UpdateConversationMessageContentResponse': # noqa: E501
2991
+ """assistants_service_update_conversation_message_content # noqa: E501
2992
+
2993
+ This method makes a synchronous HTTP request by default. To make an
2994
+ asynchronous HTTP request, please pass async_req=True
2995
+ >>> thread = api.assistants_service_update_conversation_message_content(body, project_id, assistant_id, conversation_id, id, async_req=True)
2996
+ >>> result = thread.get()
2997
+
2998
+ :param async_req bool
2999
+ :param IdContentBody body: (required)
3000
+ :param str project_id: (required)
3001
+ :param str assistant_id: (required)
3002
+ :param str conversation_id: (required)
3003
+ :param str id: (required)
3004
+ :return: V1UpdateConversationMessageContentResponse
3005
+ If the method is called asynchronously,
3006
+ returns the request thread.
3007
+ """
3008
+ kwargs['_return_http_data_only'] = True
3009
+ if kwargs.get('async_req'):
3010
+ return self.assistants_service_update_conversation_message_content_with_http_info(body, project_id, assistant_id, conversation_id, id, **kwargs) # noqa: E501
3011
+ else:
3012
+ (data) = self.assistants_service_update_conversation_message_content_with_http_info(body, project_id, assistant_id, conversation_id, id, **kwargs) # noqa: E501
3013
+ return data
3014
+
3015
+ def assistants_service_update_conversation_message_content_with_http_info(self, body: 'IdContentBody', project_id: 'str', assistant_id: 'str', conversation_id: 'str', id: 'str', **kwargs) -> 'V1UpdateConversationMessageContentResponse': # noqa: E501
3016
+ """assistants_service_update_conversation_message_content # noqa: E501
3017
+
3018
+ This method makes a synchronous HTTP request by default. To make an
3019
+ asynchronous HTTP request, please pass async_req=True
3020
+ >>> thread = api.assistants_service_update_conversation_message_content_with_http_info(body, project_id, assistant_id, conversation_id, id, async_req=True)
3021
+ >>> result = thread.get()
3022
+
3023
+ :param async_req bool
3024
+ :param IdContentBody body: (required)
3025
+ :param str project_id: (required)
3026
+ :param str assistant_id: (required)
3027
+ :param str conversation_id: (required)
3028
+ :param str id: (required)
3029
+ :return: V1UpdateConversationMessageContentResponse
3030
+ If the method is called asynchronously,
3031
+ returns the request thread.
3032
+ """
3033
+
3034
+ all_params = ['body', 'project_id', 'assistant_id', 'conversation_id', 'id'] # noqa: E501
3035
+ all_params.append('async_req')
3036
+ all_params.append('_return_http_data_only')
3037
+ all_params.append('_preload_content')
3038
+ all_params.append('_request_timeout')
3039
+
3040
+ params = locals()
3041
+ for key, val in six.iteritems(params['kwargs']):
3042
+ if key not in all_params:
3043
+ raise TypeError(
3044
+ "Got an unexpected keyword argument '%s'"
3045
+ " to method assistants_service_update_conversation_message_content" % key
3046
+ )
3047
+ params[key] = val
3048
+ del params['kwargs']
3049
+ # verify the required parameter 'body' is set
3050
+ if ('body' not in params or
3051
+ params['body'] is None):
3052
+ raise ValueError("Missing the required parameter `body` when calling `assistants_service_update_conversation_message_content`") # noqa: E501
3053
+ # verify the required parameter 'project_id' is set
3054
+ if ('project_id' not in params or
3055
+ params['project_id'] is None):
3056
+ raise ValueError("Missing the required parameter `project_id` when calling `assistants_service_update_conversation_message_content`") # noqa: E501
3057
+ # verify the required parameter 'assistant_id' is set
3058
+ if ('assistant_id' not in params or
3059
+ params['assistant_id'] is None):
3060
+ raise ValueError("Missing the required parameter `assistant_id` when calling `assistants_service_update_conversation_message_content`") # noqa: E501
3061
+ # verify the required parameter 'conversation_id' is set
3062
+ if ('conversation_id' not in params or
3063
+ params['conversation_id'] is None):
3064
+ raise ValueError("Missing the required parameter `conversation_id` when calling `assistants_service_update_conversation_message_content`") # noqa: E501
3065
+ # verify the required parameter 'id' is set
3066
+ if ('id' not in params or
3067
+ params['id'] is None):
3068
+ raise ValueError("Missing the required parameter `id` when calling `assistants_service_update_conversation_message_content`") # noqa: E501
3069
+
3070
+ collection_formats = {}
3071
+
3072
+ path_params = {}
3073
+ if 'project_id' in params:
3074
+ path_params['projectId'] = params['project_id'] # noqa: E501
3075
+ if 'assistant_id' in params:
3076
+ path_params['assistantId'] = params['assistant_id'] # noqa: E501
3077
+ if 'conversation_id' in params:
3078
+ path_params['conversationId'] = params['conversation_id'] # noqa: E501
3079
+ if 'id' in params:
3080
+ path_params['id'] = params['id'] # noqa: E501
3081
+
3082
+ query_params = []
3083
+
3084
+ header_params = {}
3085
+
3086
+ form_params = []
3087
+ local_var_files = {}
3088
+
3089
+ body_params = None
3090
+ if 'body' in params:
3091
+ body_params = params['body']
3092
+ # HTTP header `Accept`
3093
+ header_params['Accept'] = self.api_client.select_header_accept(
3094
+ ['application/json']) # noqa: E501
3095
+
3096
+ # HTTP header `Content-Type`
3097
+ header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
3098
+ ['application/json']) # noqa: E501
3099
+
3100
+ # Authentication setting
3101
+ auth_settings = [] # noqa: E501
3102
+
3103
+ return self.api_client.call_api(
3104
+ '/v1/projects/{projectId}/agents/{assistantId}/conversations/{conversationId}/messages/{id}/content', 'PUT',
3105
+ path_params,
3106
+ query_params,
3107
+ header_params,
3108
+ body=body_params,
3109
+ post_params=form_params,
3110
+ files=local_var_files,
3111
+ response_type='V1UpdateConversationMessageContentResponse', # noqa: E501
3112
+ auth_settings=auth_settings,
3113
+ async_req=params.get('async_req'),
3114
+ _return_http_data_only=params.get('_return_http_data_only'),
3115
+ _preload_content=params.get('_preload_content', True),
3116
+ _request_timeout=params.get('_request_timeout'),
3117
+ collection_formats=collection_formats)
3118
+
2986
3119
  def assistants_service_update_conversation_message_like(self, body: 'MessagesIdBody', project_id: 'str', assistant_id: 'str', conversation_id: 'str', id: 'str', **kwargs) -> 'V1UpdateConversationMessageLikeResponse': # noqa: E501
2987
3120
  """assistants_service_update_conversation_message_like # noqa: E501
2988
3121
 
@@ -3152,6 +3152,7 @@ class ClusterServiceApi(object):
3152
3152
  :param async_req bool
3153
3153
  :param str org_id:
3154
3154
  :param str project_id:
3155
+ :param bool include_configuring_state:
3155
3156
  :return: V1ListClustersResponse
3156
3157
  If the method is called asynchronously,
3157
3158
  returns the request thread.
@@ -3174,12 +3175,13 @@ class ClusterServiceApi(object):
3174
3175
  :param async_req bool
3175
3176
  :param str org_id:
3176
3177
  :param str project_id:
3178
+ :param bool include_configuring_state:
3177
3179
  :return: V1ListClustersResponse
3178
3180
  If the method is called asynchronously,
3179
3181
  returns the request thread.
3180
3182
  """
3181
3183
 
3182
- all_params = ['org_id', 'project_id'] # noqa: E501
3184
+ all_params = ['org_id', 'project_id', 'include_configuring_state'] # noqa: E501
3183
3185
  all_params.append('async_req')
3184
3186
  all_params.append('_return_http_data_only')
3185
3187
  all_params.append('_preload_content')
@@ -3204,6 +3206,8 @@ class ClusterServiceApi(object):
3204
3206
  query_params.append(('orgId', params['org_id'])) # noqa: E501
3205
3207
  if 'project_id' in params:
3206
3208
  query_params.append(('projectId', params['project_id'])) # noqa: E501
3209
+ if 'include_configuring_state' in params:
3210
+ query_params.append(('includeConfiguringState', params['include_configuring_state'])) # noqa: E501
3207
3211
 
3208
3212
  header_params = {}
3209
3213