lightning-sdk 0.2.8__py3-none-any.whl → 0.2.9__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 (32) hide show
  1. lightning_sdk/__init__.py +1 -1
  2. lightning_sdk/api/cluster_api.py +22 -0
  3. lightning_sdk/api/lit_container_api.py +5 -3
  4. lightning_sdk/api/teamspace_api.py +2 -1
  5. lightning_sdk/cli/clusters_menu.py +46 -0
  6. lightning_sdk/cli/list.py +25 -5
  7. lightning_sdk/cli/serve.py +102 -19
  8. lightning_sdk/lightning_cloud/openapi/__init__.py +5 -0
  9. lightning_sdk/lightning_cloud/openapi/api/cloud_space_service_api.py +206 -0
  10. lightning_sdk/lightning_cloud/openapi/models/__init__.py +5 -0
  11. lightning_sdk/lightning_cloud/openapi/models/cloudspace_id_systemmetrics_body.py +149 -0
  12. lightning_sdk/lightning_cloud/openapi/models/v1_billing_tier.py +1 -0
  13. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_cold_start_metrics.py +53 -1
  14. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_security_options.py +27 -1
  15. lightning_sdk/lightning_cloud/openapi/models/v1_data_connection.py +27 -1
  16. lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_instance_system_metrics_aggregate_response.py +123 -0
  17. lightning_sdk/lightning_cloud/openapi/models/v1_google_cloud_direct_v1.py +27 -1
  18. lightning_sdk/lightning_cloud/openapi/models/v1_report_cloud_space_instance_system_metrics_response.py +97 -0
  19. lightning_sdk/lightning_cloud/openapi/models/v1_server_alert_phase.py +1 -0
  20. lightning_sdk/lightning_cloud/openapi/models/v1_system_metrics_aggregated.py +227 -0
  21. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +55 -185
  22. lightning_sdk/lightning_cloud/openapi/models/v1_weka_data_connection.py +227 -0
  23. lightning_sdk/lit_container.py +13 -5
  24. lightning_sdk/models.py +7 -2
  25. lightning_sdk/serve.py +0 -20
  26. lightning_sdk/teamspace.py +19 -4
  27. {lightning_sdk-0.2.8.dist-info → lightning_sdk-0.2.9.dist-info}/METADATA +1 -1
  28. {lightning_sdk-0.2.8.dist-info → lightning_sdk-0.2.9.dist-info}/RECORD +32 -25
  29. {lightning_sdk-0.2.8.dist-info → lightning_sdk-0.2.9.dist-info}/LICENSE +0 -0
  30. {lightning_sdk-0.2.8.dist-info → lightning_sdk-0.2.9.dist-info}/WHEEL +0 -0
  31. {lightning_sdk-0.2.8.dist-info → lightning_sdk-0.2.9.dist-info}/entry_points.txt +0 -0
  32. {lightning_sdk-0.2.8.dist-info → lightning_sdk-0.2.9.dist-info}/top_level.txt +0 -0
lightning_sdk/__init__.py CHANGED
@@ -31,6 +31,6 @@ __all__ = [
31
31
  "User",
32
32
  ]
33
33
 
34
- __version__ = "0.2.8"
34
+ __version__ = "0.2.9"
35
35
  _check_version_and_prompt_upgrade(__version__)
36
36
  _set_tqdm_envvars_noninteractive()
@@ -0,0 +1,22 @@
1
+ from lightning_sdk.lightning_cloud.openapi import Externalv1Cluster
2
+ from lightning_sdk.lightning_cloud.rest_client import LightningClient
3
+
4
+
5
+ class ClusterApi:
6
+ """Internal API client for API requests to cluster endpoints."""
7
+
8
+ def __init__(self) -> None:
9
+ self._client = LightningClient(max_tries=7)
10
+
11
+ def get_cluster(self, cluster_id: str, project_id: str, org_id: str) -> Externalv1Cluster:
12
+ """Gets the cluster from given params cluster_id, project_id and owner.
13
+
14
+ :param cluster_id: cluster ID test
15
+ :param project_id: the project the cluster is supposed to be associated with
16
+ :param org_id: The owning org of this cluster
17
+ :return:
18
+ """
19
+ res = self._client.cluster_service_get_cluster(id=cluster_id, org_id=org_id, project_id=project_id)
20
+ if not res:
21
+ raise ValueError(f"Cluster {cluster_id} does not exist")
22
+ return res
@@ -105,9 +105,11 @@ class LitContainerApi:
105
105
  :param cloud_account: The cluster ID of the cloud account. If None, will use the default cluster.
106
106
  :return:
107
107
  """
108
- project = self._client.lit_registry_service_get_lit_project_registry(
109
- project_id, cluster_id="" if cloud_account is None else cloud_account
110
- ) # cloud account on the CLI is cluster_id
108
+ if cloud_account is None:
109
+ project = self._client.lit_registry_service_get_lit_project_registry(project_id)
110
+ else:
111
+ project = self._client.lit_registry_service_get_lit_project_registry(project_id, cluster_id=cloud_account)
112
+
111
113
  return project.repositories
112
114
 
113
115
  def delete_container(self, project_id: str, container: str) -> V1DeleteLitRepositoryResponse:
@@ -177,6 +177,7 @@ class TeamspaceApi:
177
177
  def create_model(
178
178
  self,
179
179
  name: str,
180
+ version: Optional[str],
180
181
  metadata: Dict[str, str],
181
182
  private: bool,
182
183
  teamspace_id: str,
@@ -191,7 +192,7 @@ class TeamspaceApi:
191
192
  )
192
193
  assert len(models) == 1, "Multiple models with the same name found"
193
194
  return self.models.models_store_create_model_version(
194
- body=ModelIdVersionsBody(cluster_id=cloud_account),
195
+ body=ModelIdVersionsBody(cluster_id=cloud_account, version=version),
195
196
  project_id=teamspace_id,
196
197
  model_id=models[0].id,
197
198
  )
@@ -0,0 +1,46 @@
1
+ import sys
2
+ from typing import List
3
+
4
+ from rich.console import Console
5
+ from simple_term_menu import TerminalMenu
6
+
7
+ from lightning_sdk import Teamspace
8
+ from lightning_sdk.api.cluster_api import ClusterApi
9
+ from lightning_sdk.lightning_cloud.openapi import Externalv1Cluster, V1ProjectClusterBinding
10
+
11
+
12
+ class _ClustersMenu:
13
+ def _get_cluster_from_interactive_menu(self, possible_clusters: List[V1ProjectClusterBinding]) -> str:
14
+ terminal_menu = self._prepare_terminal_menu_teamspaces([cluster.cluster_id for cluster in possible_clusters])
15
+ terminal_menu.show()
16
+
17
+ return possible_clusters[terminal_menu.chosen_menu_index].cluster_id
18
+
19
+ @staticmethod
20
+ def _prepare_terminal_menu_teamspaces(cluster_ids: List[str]) -> TerminalMenu:
21
+ title = "Please select a cluster from the following:"
22
+
23
+ return TerminalMenu(cluster_ids, title=title, clear_menu_on_exit=True)
24
+
25
+ def _resolve_cluster(self, teamspace: Teamspace) -> Externalv1Cluster:
26
+ selected_cluster_id = None
27
+ console = Console()
28
+ try:
29
+ selected_cluster_id = self._get_cluster_from_interactive_menu(
30
+ possible_clusters=teamspace.cloud_account_objs
31
+ )
32
+ cluster_api = ClusterApi()
33
+
34
+ return cluster_api.get_cluster(
35
+ cluster_id=selected_cluster_id, org_id=teamspace.owner.id, project_id=teamspace.id
36
+ )
37
+ except KeyboardInterrupt:
38
+ console.print("Operation cancelled by user")
39
+ sys.exit(0)
40
+
41
+ except Exception:
42
+ console.print(
43
+ f"[red]Could not find the given Cluster:[/red] {selected_cluster_id}. "
44
+ "Please contact Lightning AI directly to resolve this issue."
45
+ )
46
+ sys.exit(1)
lightning_sdk/cli/list.py CHANGED
@@ -7,8 +7,9 @@ from rich.table import Table
7
7
  from typing_extensions import Literal
8
8
 
9
9
  from lightning_sdk import Job, Machine, Studio, Teamspace
10
+ from lightning_sdk.cli.clusters_menu import _ClustersMenu
10
11
  from lightning_sdk.cli.teamspace_menu import _TeamspacesMenu
11
- from lightning_sdk.lightning_cloud.openapi import V1MultiMachineJob
12
+ from lightning_sdk.lightning_cloud.openapi import V1ClusterType, V1MultiMachineJob
12
13
  from lightning_sdk.lit_container import LitContainer
13
14
  from lightning_sdk.utils.resolve import _get_authed_user
14
15
 
@@ -232,18 +233,37 @@ def mmts(
232
233
  "If not provided, can be selected in an interactive menu."
233
234
  ),
234
235
  )
235
- def containers(teamspace: Optional[str] = None) -> None:
236
+ @click.option(
237
+ "--cloud-account",
238
+ "--cloud_account", # The UI will present the above variant, using this as a secondary to be consistent w/ models
239
+ default=None,
240
+ help="The name of the cloud account where containers are stored in.",
241
+ )
242
+ def containers(teamspace: Optional[str] = None, cloud_account: Optional[str] = None) -> None:
236
243
  """Display the list of available containers."""
237
244
  api = LitContainer()
238
245
  menu = _TeamspacesMenu()
246
+ clusters_menu = _ClustersMenu()
239
247
  resolved_teamspace = menu._resolve_teamspace(teamspace=teamspace)
240
- result = api.list_containers(teamspace=resolved_teamspace.name, org=resolved_teamspace.owner.name)
248
+
249
+ if not cloud_account:
250
+ cloud_account_obj = clusters_menu._resolve_cluster(resolved_teamspace)
251
+ cloud_account = "" if cloud_account_obj.spec.cluster_type == V1ClusterType.GLOBAL else cloud_account_obj.id
252
+
253
+ result = api.list_containers(
254
+ teamspace=resolved_teamspace.name, org=resolved_teamspace.owner.name, cloud_account=cloud_account
255
+ )
256
+
257
+ if not result:
258
+ return
259
+
241
260
  table = Table(pad_edge=True, box=None)
242
261
  table.add_column("REPOSITORY")
243
- table.add_column("IMAGE ID")
262
+ table.add_column("CLOUD ACCOUNT")
263
+ table.add_column("LATEST TAG")
244
264
  table.add_column("CREATED")
245
265
  for repo in result:
246
- table.add_row(repo["REPOSITORY"], repo["IMAGE ID"], repo["CREATED"])
266
+ table.add_row(repo["REPOSITORY"], repo["CLOUD ACCOUNT"], repo["LATEST TAG"], repo["CREATED"])
247
267
  Console().print(table)
248
268
 
249
269
 
@@ -1,8 +1,11 @@
1
1
  import os
2
2
  import subprocess
3
+ import time
4
+ import webbrowser
3
5
  from datetime import datetime
4
6
  from pathlib import Path
5
7
  from typing import Optional, Union
8
+ from urllib.parse import urlencode
6
9
 
7
10
  import click
8
11
  from rich.console import Console
@@ -10,9 +13,13 @@ from rich.progress import Progress, SpinnerColumn, TextColumn, TimeElapsedColumn
10
13
  from rich.prompt import Confirm
11
14
 
12
15
  from lightning_sdk import Machine, Teamspace
16
+ from lightning_sdk.api import UserApi
13
17
  from lightning_sdk.api.lit_container_api import LitContainerApi
14
18
  from lightning_sdk.cli.teamspace_menu import _TeamspacesMenu
15
- from lightning_sdk.serve import _LitServeDeployer, authenticate
19
+ from lightning_sdk.lightning_cloud import env
20
+ from lightning_sdk.lightning_cloud.login import Auth, AuthServer
21
+ from lightning_sdk.serve import _LitServeDeployer
22
+ from lightning_sdk.utils.resolve import _get_authed_user, _resolve_teamspace
16
23
 
17
24
  _MACHINE_VALUES = tuple([machine.name for machine in Machine.__dict__.values() if isinstance(machine, Machine)])
18
25
 
@@ -31,12 +38,12 @@ def serve() -> None:
31
38
  """Serve a LitServe model.
32
39
 
33
40
  Example:
34
- lightning serve server.py # serve locally
41
+ lightning serve server.py # deploy to the cloud
35
42
 
36
43
  Example:
37
- lightning serve server.py --cloud # deploy to the cloud
44
+ lightning serve server.py --local # serve locally
38
45
 
39
- You can deploy the API to the cloud by running `lightning serve server.py --cloud`.
46
+ You can deploy the API to the cloud by running `lightning serve server.py`.
40
47
  This will build a docker container for the server.py script and deploy it to the Lightning AI platform.
41
48
  """
42
49
 
@@ -218,6 +225,69 @@ def api_impl(
218
225
  raise RuntimeError(error_msg) from None
219
226
 
220
227
 
228
+ class _AuthServer(AuthServer):
229
+ def get_auth_url(self, port: int) -> str:
230
+ redirect_uri = f"http://localhost:{port}/login-complete"
231
+ params = urlencode({"redirectTo": redirect_uri, "inviteCode": "litserve"})
232
+ return f"{env.LIGHTNING_CLOUD_URL}/sign-in?{params}"
233
+
234
+
235
+ class _Auth(Auth):
236
+ def __init__(self, shall_confirm: bool = False) -> None:
237
+ super().__init__()
238
+ self._shall_confirm = shall_confirm
239
+
240
+ def _run_server(self) -> None:
241
+ if self._shall_confirm:
242
+ proceed = Confirm.ask(
243
+ "Authenticating with Lightning AI. This will open a browser window. Continue?", default=True
244
+ )
245
+ if not proceed:
246
+ raise RuntimeError(
247
+ "Login cancelled. Please login to Lightning AI to deploy the API."
248
+ " Run `lightning login` to login."
249
+ ) from None
250
+ print("Opening browser for authentication...")
251
+ print("Please come back to the terminal after logging in.")
252
+ time.sleep(3)
253
+ _AuthServer().login_with_browser(self)
254
+
255
+
256
+ def authenticate(shall_confirm: bool = True) -> None:
257
+ auth = _Auth(shall_confirm)
258
+ auth.authenticate()
259
+
260
+
261
+ def select_teamspace(teamspace: Optional[str], org: Optional[str], user: Optional[str]) -> Teamspace:
262
+ if teamspace is None:
263
+ user = _get_authed_user()
264
+ menu = _TeamspacesMenu()
265
+ possible_teamspaces = menu._get_possible_teamspaces(user)
266
+ if len(possible_teamspaces) == 1:
267
+ name = next(iter(possible_teamspaces.values()))["name"]
268
+ return Teamspace(name=name, org=org, user=user)
269
+
270
+ return menu._resolve_teamspace(teamspace)
271
+
272
+ return _resolve_teamspace(teamspace=teamspace, org=org, user=user)
273
+
274
+
275
+ def poll_verified_status() -> bool:
276
+ """Polls the verified status of the user until it is True or a timeout occurs."""
277
+ user_api = UserApi()
278
+ user = _get_authed_user()
279
+ start_time = datetime.now()
280
+ timeout = 600 # 10 minutes
281
+ while True:
282
+ user_resp = user_api.get_user(name=user.name)
283
+ if user_resp.status.verified:
284
+ return True
285
+ if (datetime.now() - start_time).total_seconds() > timeout:
286
+ break
287
+ time.sleep(5)
288
+ return False
289
+
290
+
221
291
  def _handle_cloud(
222
292
  script_path: Union[str, Path],
223
293
  console: Console,
@@ -242,16 +312,8 @@ def _handle_cloud(
242
312
  if non_interactive:
243
313
  console.print("[italic]non-interactive[/italic] mode enabled, skipping confirmation prompts", style="blue")
244
314
 
245
- # Authenticate with LitServe affiliate
246
- authenticate()
247
- if teamspace is None:
248
- menu = _TeamspacesMenu()
249
- resolved_teamspace = menu._resolve_teamspace(teamspace)
250
- else:
251
- resolved_teamspace = Teamspace(name=teamspace, org=org, user=user)
252
-
253
315
  port = port or 8000
254
- ls_deployer = _LitServeDeployer(name=deployment_name, teamspace=resolved_teamspace)
316
+ ls_deployer = _LitServeDeployer(name=deployment_name, teamspace=None)
255
317
  path = ls_deployer.dockerize_api(script_path, port=port, gpu=not machine.is_cpu(), tag=tag, print_success=False)
256
318
 
257
319
  console.print(f"\nPlease review the Dockerfile at [u]{path}[/u] and make sure it is correct.", style="bold")
@@ -260,10 +322,6 @@ def _handle_cloud(
260
322
  console.print("Please fix the Dockerfile and try again.", style="red")
261
323
  return
262
324
 
263
- # list containers to create the project if it doesn't exist
264
- lit_cr = LitContainerApi()
265
- lit_cr.list_containers(resolved_teamspace.id, cloud_account=cloud_account)
266
-
267
325
  with Progress(
268
326
  SpinnerColumn(),
269
327
  TextColumn("[progress.description]{task.description}"),
@@ -280,8 +338,32 @@ def _handle_cloud(
280
338
  progress.update(build_task, description="[green]Build completed![/green]", completed=1.0)
281
339
  progress.remove_task(build_task)
282
340
 
283
- # Push the container to the registry
284
- console.print("\nPushing image to registry. It may take a while...", style="bold")
341
+ except Exception as e:
342
+ console.print(f" Deployment failed: {e}", style="red")
343
+ return
344
+
345
+ # Push the container to the registry
346
+ console.print("\nPushing container to registry. It may take a while...", style="bold")
347
+ # Authenticate with LitServe affiliate
348
+ authenticate(shall_confirm=not non_interactive)
349
+ resolved_teamspace = select_teamspace(teamspace, org, user)
350
+ verified = poll_verified_status()
351
+ if not verified:
352
+ console.print("❌ Verify phone number to continue. Visit lightning.ai.", style="red")
353
+ return
354
+
355
+ # list containers to create the project if it doesn't exist
356
+ lit_cr = LitContainerApi()
357
+ lit_cr.list_containers(resolved_teamspace.id, cloud_account=cloud_account)
358
+
359
+ with Progress(
360
+ SpinnerColumn(),
361
+ TextColumn("[progress.description]{task.description}"),
362
+ TimeElapsedColumn(),
363
+ console=console,
364
+ transient=True,
365
+ ) as progress:
366
+ try:
285
367
  push_task = progress.add_task("Pushing to registry", total=None)
286
368
  push_status = {}
287
369
  for line in ls_deployer.push_container(
@@ -313,3 +395,4 @@ def _handle_cloud(
313
395
  include_credentials=include_credentials,
314
396
  )
315
397
  console.print(f"🚀 Deployment started, access at [i]{deployment_status.get('url')}[/i]")
398
+ webbrowser.open(deployment_status.get("url"))
@@ -83,6 +83,7 @@ from lightning_sdk.lightning_cloud.openapi.models.cloud_space_id_versionpublicat
83
83
  from lightning_sdk.lightning_cloud.openapi.models.cloud_space_id_versions_body import CloudSpaceIdVersionsBody
84
84
  from lightning_sdk.lightning_cloud.openapi.models.cloudspace_id_metric_body import CloudspaceIdMetricBody
85
85
  from lightning_sdk.lightning_cloud.openapi.models.cloudspace_id_runs_body import CloudspaceIdRunsBody
86
+ from lightning_sdk.lightning_cloud.openapi.models.cloudspace_id_systemmetrics_body import CloudspaceIdSystemmetricsBody
86
87
  from lightning_sdk.lightning_cloud.openapi.models.cloudspaces_id_body import CloudspacesIdBody
87
88
  from lightning_sdk.lightning_cloud.openapi.models.cluster_id_capacityblock_body import ClusterIdCapacityblockBody
88
89
  from lightning_sdk.lightning_cloud.openapi.models.cluster_id_capacityreservations_body import ClusterIdCapacityreservationsBody
@@ -495,6 +496,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_env_response
495
496
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_logs_metadata_response import V1GetAgentJobLogsMetadataResponse
496
497
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_artifacts_page_response import V1GetArtifactsPageResponse
497
498
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_status_response import V1GetCloudSpaceInstanceStatusResponse
499
+ from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_system_metrics_aggregate_response import V1GetCloudSpaceInstanceSystemMetricsAggregateResponse
498
500
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_size_response import V1GetCloudSpaceSizeResponse
499
501
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_accelerator_demand_response import V1GetClusterAcceleratorDemandResponse
500
502
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_credentials_response import V1GetClusterCredentialsResponse
@@ -775,6 +777,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_refresh_response import V1R
775
777
  from lightning_sdk.lightning_cloud.openapi.models.v1_region_state import V1RegionState
776
778
  from lightning_sdk.lightning_cloud.openapi.models.v1_regional_load_balancer import V1RegionalLoadBalancer
777
779
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_cloud_space_instance_stop_at_response import V1ReportCloudSpaceInstanceStopAtResponse
780
+ from lightning_sdk.lightning_cloud.openapi.models.v1_report_cloud_space_instance_system_metrics_response import V1ReportCloudSpaceInstanceSystemMetricsResponse
778
781
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_logs_activity_response import V1ReportLogsActivityResponse
779
782
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_restart_timings_response import V1ReportRestartTimingsResponse
780
783
  from lightning_sdk.lightning_cloud.openapi.models.v1_request_cluster_access_request import V1RequestClusterAccessRequest
@@ -840,6 +843,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_subnet_spec import V1Subnet
840
843
  from lightning_sdk.lightning_cloud.openapi.models.v1_switch_cloud_space_instance_response import V1SwitchCloudSpaceInstanceResponse
841
844
  from lightning_sdk.lightning_cloud.openapi.models.v1_system_info import V1SystemInfo
842
845
  from lightning_sdk.lightning_cloud.openapi.models.v1_system_metrics import V1SystemMetrics
846
+ from lightning_sdk.lightning_cloud.openapi.models.v1_system_metrics_aggregated import V1SystemMetricsAggregated
843
847
  from lightning_sdk.lightning_cloud.openapi.models.v1_system_metrics_list import V1SystemMetricsList
844
848
  from lightning_sdk.lightning_cloud.openapi.models.v1_telemetry import V1Telemetry
845
849
  from lightning_sdk.lightning_cloud.openapi.models.v1_timestamp_code_telemetry import V1TimestampCodeTelemetry
@@ -903,6 +907,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_verify_verification_respons
903
907
  from lightning_sdk.lightning_cloud.openapi.models.v1_voltage_park_direct_v1 import V1VoltageParkDirectV1
904
908
  from lightning_sdk.lightning_cloud.openapi.models.v1_volume import V1Volume
905
909
  from lightning_sdk.lightning_cloud.openapi.models.v1_vultr_direct_v1 import V1VultrDirectV1
910
+ from lightning_sdk.lightning_cloud.openapi.models.v1_weka_data_connection import V1WekaDataConnection
906
911
  from lightning_sdk.lightning_cloud.openapi.models.v1_work import V1Work
907
912
  from lightning_sdk.lightning_cloud.openapi.models.validate import Validate
908
913
  from lightning_sdk.lightning_cloud.openapi.models.validateautojoindomain_domain_body import ValidateautojoindomainDomainBody
@@ -3489,6 +3489,99 @@ class CloudSpaceServiceApi(object):
3489
3489
  _request_timeout=params.get('_request_timeout'),
3490
3490
  collection_formats=collection_formats)
3491
3491
 
3492
+ def cloud_space_service_get_cloud_space_instance_system_metrics_aggregate(self, project_id: 'str', **kwargs) -> 'V1GetCloudSpaceInstanceSystemMetricsAggregateResponse': # noqa: E501
3493
+ """cloud_space_service_get_cloud_space_instance_system_metrics_aggregate # noqa: E501
3494
+
3495
+ This method makes a synchronous HTTP request by default. To make an
3496
+ asynchronous HTTP request, please pass async_req=True
3497
+ >>> thread = api.cloud_space_service_get_cloud_space_instance_system_metrics_aggregate(project_id, async_req=True)
3498
+ >>> result = thread.get()
3499
+
3500
+ :param async_req bool
3501
+ :param str project_id: (required)
3502
+ :return: V1GetCloudSpaceInstanceSystemMetricsAggregateResponse
3503
+ If the method is called asynchronously,
3504
+ returns the request thread.
3505
+ """
3506
+ kwargs['_return_http_data_only'] = True
3507
+ if kwargs.get('async_req'):
3508
+ return self.cloud_space_service_get_cloud_space_instance_system_metrics_aggregate_with_http_info(project_id, **kwargs) # noqa: E501
3509
+ else:
3510
+ (data) = self.cloud_space_service_get_cloud_space_instance_system_metrics_aggregate_with_http_info(project_id, **kwargs) # noqa: E501
3511
+ return data
3512
+
3513
+ def cloud_space_service_get_cloud_space_instance_system_metrics_aggregate_with_http_info(self, project_id: 'str', **kwargs) -> 'V1GetCloudSpaceInstanceSystemMetricsAggregateResponse': # noqa: E501
3514
+ """cloud_space_service_get_cloud_space_instance_system_metrics_aggregate # noqa: E501
3515
+
3516
+ This method makes a synchronous HTTP request by default. To make an
3517
+ asynchronous HTTP request, please pass async_req=True
3518
+ >>> thread = api.cloud_space_service_get_cloud_space_instance_system_metrics_aggregate_with_http_info(project_id, async_req=True)
3519
+ >>> result = thread.get()
3520
+
3521
+ :param async_req bool
3522
+ :param str project_id: (required)
3523
+ :return: V1GetCloudSpaceInstanceSystemMetricsAggregateResponse
3524
+ If the method is called asynchronously,
3525
+ returns the request thread.
3526
+ """
3527
+
3528
+ all_params = ['project_id'] # noqa: E501
3529
+ all_params.append('async_req')
3530
+ all_params.append('_return_http_data_only')
3531
+ all_params.append('_preload_content')
3532
+ all_params.append('_request_timeout')
3533
+
3534
+ params = locals()
3535
+ for key, val in six.iteritems(params['kwargs']):
3536
+ if key not in all_params:
3537
+ raise TypeError(
3538
+ "Got an unexpected keyword argument '%s'"
3539
+ " to method cloud_space_service_get_cloud_space_instance_system_metrics_aggregate" % key
3540
+ )
3541
+ params[key] = val
3542
+ del params['kwargs']
3543
+ # verify the required parameter 'project_id' is set
3544
+ if ('project_id' not in params or
3545
+ params['project_id'] is None):
3546
+ raise ValueError("Missing the required parameter `project_id` when calling `cloud_space_service_get_cloud_space_instance_system_metrics_aggregate`") # noqa: E501
3547
+
3548
+ collection_formats = {}
3549
+
3550
+ path_params = {}
3551
+ if 'project_id' in params:
3552
+ path_params['projectId'] = params['project_id'] # noqa: E501
3553
+
3554
+ query_params = []
3555
+
3556
+ header_params = {}
3557
+
3558
+ form_params = []
3559
+ local_var_files = {}
3560
+
3561
+ body_params = None
3562
+ # HTTP header `Accept`
3563
+ header_params['Accept'] = self.api_client.select_header_accept(
3564
+ ['application/json']) # noqa: E501
3565
+
3566
+ # Authentication setting
3567
+ auth_settings = [] # noqa: E501
3568
+
3569
+ return self.api_client.call_api(
3570
+ '/v1/projects/{projectId}/system-metrics-aggregated', 'GET',
3571
+ path_params,
3572
+ query_params,
3573
+ header_params,
3574
+ body=body_params,
3575
+ post_params=form_params,
3576
+ files=local_var_files,
3577
+ response_type='V1GetCloudSpaceInstanceSystemMetricsAggregateResponse', # noqa: E501
3578
+ auth_settings=auth_settings,
3579
+ async_req=params.get('async_req'),
3580
+ _return_http_data_only=params.get('_return_http_data_only'),
3581
+ _preload_content=params.get('_preload_content', True),
3582
+ _request_timeout=params.get('_request_timeout'),
3583
+ collection_formats=collection_formats)
3584
+
3492
3585
  def cloud_space_service_get_cloud_space_size(self, project_id: 'str', cloudspace_id: 'str', **kwargs) -> 'V1GetCloudSpaceSizeResponse': # noqa: E501
3493
3586
  """cloud_space_service_get_cloud_space_size # noqa: E501
3494
3587
 
@@ -6687,6 +6780,119 @@ class CloudSpaceServiceApi(object):
6687
6780
  _request_timeout=params.get('_request_timeout'),
6688
6781
  collection_formats=collection_formats)
6689
6782
 
6783
+ def cloud_space_service_report_cloud_space_instance_system_metrics(self, body: 'CloudspaceIdSystemmetricsBody', project_id: 'str', cloudspace_id: 'str', **kwargs) -> 'V1ReportCloudSpaceInstanceSystemMetricsResponse': # noqa: E501
6784
+ """cloud_space_service_report_cloud_space_instance_system_metrics # noqa: E501
6785
+
6786
+ This method makes a synchronous HTTP request by default. To make an
6787
+ asynchronous HTTP request, please pass async_req=True
6788
+ >>> thread = api.cloud_space_service_report_cloud_space_instance_system_metrics(body, project_id, cloudspace_id, async_req=True)
6789
+ >>> result = thread.get()
6790
+
6791
+ :param async_req bool
6792
+ :param CloudspaceIdSystemmetricsBody body: (required)
6793
+ :param str project_id: (required)
6794
+ :param str cloudspace_id: (required)
6795
+ :return: V1ReportCloudSpaceInstanceSystemMetricsResponse
6796
+ If the method is called asynchronously,
6797
+ returns the request thread.
6798
+ """
6799
+ kwargs['_return_http_data_only'] = True
6800
+ if kwargs.get('async_req'):
6801
+ return self.cloud_space_service_report_cloud_space_instance_system_metrics_with_http_info(body, project_id, cloudspace_id, **kwargs) # noqa: E501
6802
+ else:
6803
+ (data) = self.cloud_space_service_report_cloud_space_instance_system_metrics_with_http_info(body, project_id, cloudspace_id, **kwargs) # noqa: E501
6804
+ return data
6805
+
6806
+ def cloud_space_service_report_cloud_space_instance_system_metrics_with_http_info(self, body: 'CloudspaceIdSystemmetricsBody', project_id: 'str', cloudspace_id: 'str', **kwargs) -> 'V1ReportCloudSpaceInstanceSystemMetricsResponse': # noqa: E501
6807
+ """cloud_space_service_report_cloud_space_instance_system_metrics # noqa: E501
6808
+
6809
+ This method makes a synchronous HTTP request by default. To make an
6810
+ asynchronous HTTP request, please pass async_req=True
6811
+ >>> thread = api.cloud_space_service_report_cloud_space_instance_system_metrics_with_http_info(body, project_id, cloudspace_id, async_req=True)
6812
+ >>> result = thread.get()
6813
+
6814
+ :param async_req bool
6815
+ :param CloudspaceIdSystemmetricsBody body: (required)
6816
+ :param str project_id: (required)
6817
+ :param str cloudspace_id: (required)
6818
+ :return: V1ReportCloudSpaceInstanceSystemMetricsResponse
6819
+ If the method is called asynchronously,
6820
+ returns the request thread.
6821
+ """
6822
+
6823
+ all_params = ['body', 'project_id', 'cloudspace_id'] # noqa: E501
6824
+ all_params.append('async_req')
6825
+ all_params.append('_return_http_data_only')
6826
+ all_params.append('_preload_content')
6827
+ all_params.append('_request_timeout')
6828
+
6829
+ params = locals()
6830
+ for key, val in six.iteritems(params['kwargs']):
6831
+ if key not in all_params:
6832
+ raise TypeError(
6833
+ "Got an unexpected keyword argument '%s'"
6834
+ " to method cloud_space_service_report_cloud_space_instance_system_metrics" % key
6835
+ )
6836
+ params[key] = val
6837
+ del params['kwargs']
6838
+ # verify the required parameter 'body' is set
6839
+ if ('body' not in params or
6840
+ params['body'] is None):
6841
+ raise ValueError("Missing the required parameter `body` when calling `cloud_space_service_report_cloud_space_instance_system_metrics`") # noqa: E501
6842
+ # verify the required parameter 'project_id' is set
6843
+ if ('project_id' not in params or
6844
+ params['project_id'] is None):
6845
+ raise ValueError("Missing the required parameter `project_id` when calling `cloud_space_service_report_cloud_space_instance_system_metrics`") # noqa: E501
6846
+ # verify the required parameter 'cloudspace_id' is set
6847
+ if ('cloudspace_id' not in params or
6848
+ params['cloudspace_id'] is None):
6849
+ raise ValueError("Missing the required parameter `cloudspace_id` when calling `cloud_space_service_report_cloud_space_instance_system_metrics`") # noqa: E501
6850
+
6851
+ collection_formats = {}
6852
+
6853
+ path_params = {}
6854
+ if 'project_id' in params:
6855
+ path_params['projectId'] = params['project_id'] # noqa: E501
6856
+ if 'cloudspace_id' in params:
6857
+ path_params['cloudspaceId'] = params['cloudspace_id'] # noqa: E501
6858
+
6859
+ query_params = []
6860
+
6861
+ header_params = {}
6862
+
6863
+ form_params = []
6864
+ local_var_files = {}
6865
+
6866
+ body_params = None
6867
+ if 'body' in params:
6868
+ body_params = params['body']
6869
+ # HTTP header `Accept`
6870
+ header_params['Accept'] = self.api_client.select_header_accept(
6871
+ ['application/json']) # noqa: E501
6872
+
6873
+ # HTTP header `Content-Type`
6874
+ header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
6875
+ ['application/json']) # noqa: E501
6876
+
6877
+ # Authentication setting
6878
+ auth_settings = [] # noqa: E501
6879
+
6880
+ return self.api_client.call_api(
6881
+ '/v1/projects/{projectId}/cloudspaces/{cloudspaceId}/system-metrics', 'POST',
6882
+ path_params,
6883
+ query_params,
6884
+ header_params,
6885
+ body=body_params,
6886
+ post_params=form_params,
6887
+ files=local_var_files,
6888
+ response_type='V1ReportCloudSpaceInstanceSystemMetricsResponse', # noqa: E501
6889
+ auth_settings=auth_settings,
6890
+ async_req=params.get('async_req'),
6891
+ _return_http_data_only=params.get('_return_http_data_only'),
6892
+ _preload_content=params.get('_preload_content', True),
6893
+ _request_timeout=params.get('_request_timeout'),
6894
+ collection_formats=collection_formats)
6895
+
6690
6896
  def cloud_space_service_restart_cloud_space_instance(self, project_id: 'str', id: 'str', **kwargs) -> 'V1RestartCloudSpaceInstanceResponse': # noqa: E501
6691
6897
  """cloud_space_service_restart_cloud_space_instance # noqa: E501
6692
6898
 
@@ -41,6 +41,7 @@ from lightning_sdk.lightning_cloud.openapi.models.cloud_space_id_versionpublicat
41
41
  from lightning_sdk.lightning_cloud.openapi.models.cloud_space_id_versions_body import CloudSpaceIdVersionsBody
42
42
  from lightning_sdk.lightning_cloud.openapi.models.cloudspace_id_metric_body import CloudspaceIdMetricBody
43
43
  from lightning_sdk.lightning_cloud.openapi.models.cloudspace_id_runs_body import CloudspaceIdRunsBody
44
+ from lightning_sdk.lightning_cloud.openapi.models.cloudspace_id_systemmetrics_body import CloudspaceIdSystemmetricsBody
44
45
  from lightning_sdk.lightning_cloud.openapi.models.cloudspaces_id_body import CloudspacesIdBody
45
46
  from lightning_sdk.lightning_cloud.openapi.models.cluster_id_capacityblock_body import ClusterIdCapacityblockBody
46
47
  from lightning_sdk.lightning_cloud.openapi.models.cluster_id_capacityreservations_body import ClusterIdCapacityreservationsBody
@@ -453,6 +454,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_env_response
453
454
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_agent_job_logs_metadata_response import V1GetAgentJobLogsMetadataResponse
454
455
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_artifacts_page_response import V1GetArtifactsPageResponse
455
456
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_status_response import V1GetCloudSpaceInstanceStatusResponse
457
+ from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_instance_system_metrics_aggregate_response import V1GetCloudSpaceInstanceSystemMetricsAggregateResponse
456
458
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_size_response import V1GetCloudSpaceSizeResponse
457
459
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_accelerator_demand_response import V1GetClusterAcceleratorDemandResponse
458
460
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_credentials_response import V1GetClusterCredentialsResponse
@@ -733,6 +735,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_refresh_response import V1R
733
735
  from lightning_sdk.lightning_cloud.openapi.models.v1_region_state import V1RegionState
734
736
  from lightning_sdk.lightning_cloud.openapi.models.v1_regional_load_balancer import V1RegionalLoadBalancer
735
737
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_cloud_space_instance_stop_at_response import V1ReportCloudSpaceInstanceStopAtResponse
738
+ from lightning_sdk.lightning_cloud.openapi.models.v1_report_cloud_space_instance_system_metrics_response import V1ReportCloudSpaceInstanceSystemMetricsResponse
736
739
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_logs_activity_response import V1ReportLogsActivityResponse
737
740
  from lightning_sdk.lightning_cloud.openapi.models.v1_report_restart_timings_response import V1ReportRestartTimingsResponse
738
741
  from lightning_sdk.lightning_cloud.openapi.models.v1_request_cluster_access_request import V1RequestClusterAccessRequest
@@ -798,6 +801,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_subnet_spec import V1Subnet
798
801
  from lightning_sdk.lightning_cloud.openapi.models.v1_switch_cloud_space_instance_response import V1SwitchCloudSpaceInstanceResponse
799
802
  from lightning_sdk.lightning_cloud.openapi.models.v1_system_info import V1SystemInfo
800
803
  from lightning_sdk.lightning_cloud.openapi.models.v1_system_metrics import V1SystemMetrics
804
+ from lightning_sdk.lightning_cloud.openapi.models.v1_system_metrics_aggregated import V1SystemMetricsAggregated
801
805
  from lightning_sdk.lightning_cloud.openapi.models.v1_system_metrics_list import V1SystemMetricsList
802
806
  from lightning_sdk.lightning_cloud.openapi.models.v1_telemetry import V1Telemetry
803
807
  from lightning_sdk.lightning_cloud.openapi.models.v1_timestamp_code_telemetry import V1TimestampCodeTelemetry
@@ -861,6 +865,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_verify_verification_respons
861
865
  from lightning_sdk.lightning_cloud.openapi.models.v1_voltage_park_direct_v1 import V1VoltageParkDirectV1
862
866
  from lightning_sdk.lightning_cloud.openapi.models.v1_volume import V1Volume
863
867
  from lightning_sdk.lightning_cloud.openapi.models.v1_vultr_direct_v1 import V1VultrDirectV1
868
+ from lightning_sdk.lightning_cloud.openapi.models.v1_weka_data_connection import V1WekaDataConnection
864
869
  from lightning_sdk.lightning_cloud.openapi.models.v1_work import V1Work
865
870
  from lightning_sdk.lightning_cloud.openapi.models.validate import Validate
866
871
  from lightning_sdk.lightning_cloud.openapi.models.validateautojoindomain_domain_body import ValidateautojoindomainDomainBody