lightning-sdk 0.1.47__py3-none-any.whl → 0.1.49__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 (47) hide show
  1. lightning_sdk/__init__.py +3 -1
  2. lightning_sdk/api/job_api.py +19 -1
  3. lightning_sdk/api/lit_container_api.py +42 -0
  4. lightning_sdk/api/mmt_api.py +6 -0
  5. lightning_sdk/api/utils.py +8 -1
  6. lightning_sdk/cli/delete.py +58 -0
  7. lightning_sdk/cli/entrypoint.py +17 -0
  8. lightning_sdk/cli/inspect.py +31 -0
  9. lightning_sdk/cli/job_and_mmt_action.py +37 -0
  10. lightning_sdk/cli/jobs_menu.py +57 -0
  11. lightning_sdk/cli/list.py +62 -4
  12. lightning_sdk/cli/mmts_menu.py +57 -0
  13. lightning_sdk/cli/run.py +22 -3
  14. lightning_sdk/cli/stop.py +37 -0
  15. lightning_sdk/cli/upload.py +32 -1
  16. lightning_sdk/job/base.py +24 -1
  17. lightning_sdk/job/job.py +34 -9
  18. lightning_sdk/job/v1.py +1 -1
  19. lightning_sdk/job/v2.py +16 -11
  20. lightning_sdk/lightning_cloud/openapi/__init__.py +3 -1
  21. lightning_sdk/lightning_cloud/openapi/api/lit_registry_service_api.py +124 -23
  22. lightning_sdk/lightning_cloud/openapi/api/models_store_api.py +250 -8
  23. lightning_sdk/lightning_cloud/openapi/models/__init__.py +3 -1
  24. lightning_sdk/lightning_cloud/openapi/models/v1_aws_direct_v1.py +27 -1
  25. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_spec.py +1 -29
  26. lightning_sdk/lightning_cloud/openapi/models/{v1_delete_container_response.py → v1_delete_lit_repository_response.py} +6 -6
  27. lightning_sdk/lightning_cloud/openapi/models/v1_google_cloud_direct_v1.py +29 -1
  28. lightning_sdk/lightning_cloud/openapi/models/v1_lambda_labs_direct_v1.py +31 -3
  29. lightning_sdk/lightning_cloud/openapi/models/v1_model.py +27 -1
  30. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +27 -53
  31. lightning_sdk/lightning_cloud/openapi/models/v1_vultr_direct_v1.py +81 -3
  32. lightning_sdk/lightning_cloud/openapi/models/version_default_body.py +149 -0
  33. lightning_sdk/lightning_cloud/openapi/models/versions_version_body.py +123 -0
  34. lightning_sdk/lightning_cloud/utils/data_connection.py +1 -0
  35. lightning_sdk/lit_container.py +78 -0
  36. lightning_sdk/mmt/base.py +18 -1
  37. lightning_sdk/mmt/mmt.py +35 -14
  38. lightning_sdk/mmt/v1.py +8 -2
  39. lightning_sdk/mmt/v2.py +12 -10
  40. {lightning_sdk-0.1.47.dist-info → lightning_sdk-0.1.49.dist-info}/METADATA +1 -1
  41. {lightning_sdk-0.1.47.dist-info → lightning_sdk-0.1.49.dist-info}/RECORD +45 -37
  42. lightning_sdk/api/lit_registry_api.py +0 -12
  43. lightning_sdk/lit_registry.py +0 -39
  44. {lightning_sdk-0.1.47.dist-info → lightning_sdk-0.1.49.dist-info}/LICENSE +0 -0
  45. {lightning_sdk-0.1.47.dist-info → lightning_sdk-0.1.49.dist-info}/WHEEL +0 -0
  46. {lightning_sdk-0.1.47.dist-info → lightning_sdk-0.1.49.dist-info}/entry_points.txt +0 -0
  47. {lightning_sdk-0.1.47.dist-info → lightning_sdk-0.1.49.dist-info}/top_level.txt +0 -0
@@ -4,18 +4,22 @@ import os
4
4
  from pathlib import Path
5
5
  from typing import Dict, List, Optional
6
6
 
7
+ from rich.console import Console
8
+ from rich.progress import Progress, SpinnerColumn, TextColumn, TimeElapsedColumn
7
9
  from simple_term_menu import TerminalMenu
8
10
  from tqdm import tqdm
9
11
 
12
+ from lightning_sdk.api.lit_container_api import LitContainerApi
10
13
  from lightning_sdk.api.utils import _get_cloud_url
11
14
  from lightning_sdk.cli.exceptions import StudioCliError
12
15
  from lightning_sdk.cli.studios_menu import _StudiosMenu
16
+ from lightning_sdk.cli.teamspace_menu import _TeamspacesMenu
13
17
  from lightning_sdk.models import upload_model
14
18
  from lightning_sdk.studio import Studio
15
19
  from lightning_sdk.utils.resolve import _get_authed_user, skip_studio_init
16
20
 
17
21
 
18
- class _Uploads(_StudiosMenu):
22
+ class _Uploads(_StudiosMenu, _TeamspacesMenu):
19
23
  """Upload files and folders to Lightning AI."""
20
24
 
21
25
  _studio_upload_status_path = "~/.lightning/studios/uploads"
@@ -146,6 +150,33 @@ class _Uploads(_StudiosMenu):
146
150
  )
147
151
  print(f"See your file at {studio_url}")
148
152
 
153
+ def container(self, container: str, tag: str = "latest", teamspace: Optional[str] = None) -> None:
154
+ teamspace = self._resolve_teamspace(teamspace)
155
+ api = LitContainerApi()
156
+ console = Console()
157
+ with Progress(
158
+ SpinnerColumn(),
159
+ TextColumn("[progress.description]{task.description}"),
160
+ TimeElapsedColumn(),
161
+ console=console,
162
+ transient=False,
163
+ ) as progress:
164
+ push_task = progress.add_task("Pushing Docker image", total=None)
165
+ resp = api.upload_container(container, teamspace, tag)
166
+ for line in resp:
167
+ if "status" in line:
168
+ console.print(line["status"], style="bright_black")
169
+ progress.update(push_task, description="Pushing Docker image")
170
+ elif "aux" in line:
171
+ console.print(line["aux"], style="bright_black")
172
+ elif "error" in line:
173
+ progress.stop()
174
+ console.print(f"\n[red]{line}[/red]")
175
+ return
176
+ else:
177
+ console.print(line, style="bright_black")
178
+ progress.update(push_task, description="[green]Container pushed![/green]")
179
+
149
180
  def _start_parallel_upload(
150
181
  self, executor: concurrent.futures.ThreadPoolExecutor, studio: Studio, upload_state: Dict[str, str]
151
182
  ) -> List[concurrent.futures.Future]:
lightning_sdk/job/base.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from typing import TYPE_CHECKING, Any, Dict, Optional, TypedDict, Union
3
3
 
4
+ from lightning_sdk.api.utils import _get_cloud_url
4
5
  from lightning_sdk.utils.resolve import _resolve_deprecated_cluster, _resolve_teamspace
5
6
 
6
7
  if TYPE_CHECKING:
@@ -23,6 +24,7 @@ class JobDict(MachineDict):
23
24
  teamspace: str
24
25
  studio: Optional[str]
25
26
  image: Optional[str]
27
+ total_cost: float
26
28
 
27
29
 
28
30
  class _BaseJob(ABC):
@@ -60,6 +62,8 @@ class _BaseJob(ABC):
60
62
  if _fetch_job:
61
63
  self._update_internal_job()
62
64
 
65
+ self._prevent_refetch_latest = False
66
+
63
67
  @classmethod
64
68
  def run(
65
69
  cls,
@@ -331,6 +335,7 @@ class _BaseJob(ABC):
331
335
  "command": self.command,
332
336
  "status": self.status,
333
337
  "machine": self.machine,
338
+ "total_cost": self.total_cost,
334
339
  }
335
340
 
336
341
  def json(self) -> str:
@@ -345,7 +350,10 @@ class _BaseJob(ABC):
345
350
  studio_name = self._job_api.get_studio_name(self._guaranteed_job)
346
351
  if not studio_name:
347
352
  raise RuntimeError("Cannot extract studio name from job")
348
- return f"https://lightning.ai/{self.teamspace.owner.name}/{self.teamspace.name}/studios/{studio_name}/app?app_id=jobs&job_name={self.name}"
353
+ return (
354
+ f"{_get_cloud_url()}/{self.teamspace.owner.name}/{self.teamspace.name}/studios/"
355
+ f"{studio_name}/app?app_id=jobs&job_name={self.name}"
356
+ )
349
357
 
350
358
  @property
351
359
  def _guaranteed_job(self) -> Any:
@@ -357,3 +365,18 @@ class _BaseJob(ABC):
357
365
  self._update_internal_job()
358
366
 
359
367
  return self._job
368
+
369
+ @property
370
+ def total_cost(self) -> float:
371
+ """The number of credits the job was consuming so far."""
372
+ return self._job_api.get_total_cost(self._latest_job)
373
+
374
+ @property
375
+ def _latest_job(self) -> Any:
376
+ """Guarantees to fetch the latest version of a job before returning it."""
377
+ # in some cases we know we just refetched the latest state, no need to refetch again
378
+ if self._prevent_refetch_latest:
379
+ return self._guaranteed_job
380
+
381
+ self._update_internal_job()
382
+ return self._job
lightning_sdk/job/job.py CHANGED
@@ -50,15 +50,40 @@ class Job(_BaseJob):
50
50
  user: the name of the user owning the :param`teamspace`
51
51
  in case it is owned directly by a user instead of an org.
52
52
  """
53
- internal_job_cls = _JobV2 if _has_jobs_v2() and not self._force_v1 else _JobV1
54
-
55
- self._internal_job = internal_job_cls(
56
- name=name,
57
- teamspace=teamspace,
58
- org=org,
59
- user=user,
60
- _fetch_job=_fetch_job,
61
- )
53
+ from lightning_sdk.lightning_cloud.openapi.rest import ApiException
54
+
55
+ if _has_jobs_v2() and not self._force_v1:
56
+ # try with v2 and fall back to v1
57
+ try:
58
+ job = _JobV2(
59
+ name=name,
60
+ teamspace=teamspace,
61
+ org=org,
62
+ user=user,
63
+ _fetch_job=_fetch_job,
64
+ )
65
+ except ApiException as e:
66
+ try:
67
+ job = _JobV1(
68
+ name=name,
69
+ teamspace=teamspace,
70
+ org=org,
71
+ user=user,
72
+ _fetch_job=_fetch_job,
73
+ )
74
+ except ApiException:
75
+ raise e from e
76
+
77
+ else:
78
+ job = _JobV1(
79
+ name=name,
80
+ teamspace=teamspace,
81
+ org=org,
82
+ user=user,
83
+ _fetch_job=_fetch_job,
84
+ )
85
+
86
+ self._internal_job = job
62
87
 
63
88
  @classmethod
64
89
  def run(
lightning_sdk/job/v1.py CHANGED
@@ -174,7 +174,7 @@ class _JobV1(_BaseJob):
174
174
 
175
175
  def stop(self) -> None:
176
176
  """Stops the job. is blocking until the ob is stopped."""
177
- if self.status in (Status.Stopped, Status.Failed):
177
+ if self.status in (Status.Stopped, Status.Completed, Status.Failed):
178
178
  return None
179
179
 
180
180
  return self._job_api.stop_job(self._job.id, self.teamspace.id)
lightning_sdk/job/v2.py CHANGED
@@ -1,12 +1,13 @@
1
- from typing import TYPE_CHECKING, Any, Dict, Optional, Union
1
+ from typing import TYPE_CHECKING, Dict, Optional, Union
2
2
 
3
3
  from lightning_sdk.api.job_api import JobApiV2
4
+ from lightning_sdk.api.utils import _get_cloud_url
4
5
  from lightning_sdk.job.base import _BaseJob
6
+ from lightning_sdk.status import Status
5
7
 
6
8
  if TYPE_CHECKING:
7
9
  from lightning_sdk.machine import Machine
8
10
  from lightning_sdk.organization import Organization
9
- from lightning_sdk.status import Status
10
11
  from lightning_sdk.studio import Studio
11
12
  from lightning_sdk.teamspace import Teamspace
12
13
  from lightning_sdk.user import User
@@ -120,6 +121,9 @@ class _JobV2(_BaseJob):
120
121
 
121
122
  def stop(self) -> None:
122
123
  """Stop the job. If the job is already stopped, this is a no-op. This is blocking until the job is stopped."""
124
+ if self.status in (Status.Stopped, Status.Completed, Status.Failed):
125
+ return
126
+
123
127
  self._job_api.stop_job(job_id=self._guaranteed_job.id, teamspace_id=self._teamspace.id)
124
128
 
125
129
  def delete(self) -> None:
@@ -133,12 +137,6 @@ class _JobV2(_BaseJob):
133
137
  cloudspace_id=self._guaranteed_job.spec.cloudspace_id,
134
138
  )
135
139
 
136
- @property
137
- def _latest_job(self) -> Any:
138
- """Guarantees to fetch the latest version of a job before returning it."""
139
- self._update_internal_job()
140
- return self._job
141
-
142
140
  @property
143
141
  def status(self) -> "Status":
144
142
  """The current status of the job."""
@@ -184,11 +182,18 @@ class _JobV2(_BaseJob):
184
182
 
185
183
  @property
186
184
  def link(self) -> str:
185
+ mmt_name = self._job_api.get_mmt_name(self._guaranteed_job)
186
+
187
187
  if self._job_api.get_image_name(self._guaranteed_job):
188
- return (
189
- f"https://lightning.ai/{self.teamspace.owner.name}/{self.teamspace.name}/jobs/{self.name}?app_id=jobs"
190
- )
188
+ if mmt_name:
189
+ # don't go via the studio unless we use studio env
190
+ return (
191
+ f"{_get_cloud_url()}/{self.teamspace.owner.name}/{self.teamspace.name}/"
192
+ f"jobs/{mmt_name}?app_id=mmt&machine_name={self.name}"
193
+ )
194
+ return f"{_get_cloud_url()}/{self.teamspace.owner.name}/{self.teamspace.name}/jobs/{self.name}?app_id=jobs"
191
195
 
196
+ # TODO: MMT env with studio
192
197
  return super().link
193
198
 
194
199
  @property
@@ -327,7 +327,6 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_capacity_res
327
327
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_encryption_key_response import V1DeleteClusterEncryptionKeyResponse
328
328
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_proxy_response import V1DeleteClusterProxyResponse
329
329
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_cluster_response import V1DeleteClusterResponse
330
- from lightning_sdk.lightning_cloud.openapi.models.v1_delete_container_response import V1DeleteContainerResponse
331
330
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_conversation_response import V1DeleteConversationResponse
332
331
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_data_connection_response import V1DeleteDataConnectionResponse
333
332
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_dataset_response import V1DeleteDatasetResponse
@@ -342,6 +341,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_delete_lightningapp_instanc
342
341
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_lightningapp_instance_response import V1DeleteLightningappInstanceResponse
343
342
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_lightningwork_response import V1DeleteLightningworkResponse
344
343
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_lit_page_response import V1DeleteLitPageResponse
344
+ from lightning_sdk.lightning_cloud.openapi.models.v1_delete_lit_repository_response import V1DeleteLitRepositoryResponse
345
345
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_logger_artifact_response import V1DeleteLoggerArtifactResponse
346
346
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_managed_endpoint_response import V1DeleteManagedEndpointResponse
347
347
  from lightning_sdk.lightning_cloud.openapi.models.v1_delete_metrics_stream_response import V1DeleteMetricsStreamResponse
@@ -794,8 +794,10 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_vultr_direct_v1 import V1Vu
794
794
  from lightning_sdk.lightning_cloud.openapi.models.v1_work import V1Work
795
795
  from lightning_sdk.lightning_cloud.openapi.models.validate import Validate
796
796
  from lightning_sdk.lightning_cloud.openapi.models.validateautojoindomain_domain_body import ValidateautojoindomainDomainBody
797
+ from lightning_sdk.lightning_cloud.openapi.models.version_default_body import VersionDefaultBody
797
798
  from lightning_sdk.lightning_cloud.openapi.models.version_uploads_body import VersionUploadsBody
798
799
  from lightning_sdk.lightning_cloud.openapi.models.versions_id_body import VersionsIdBody
800
+ from lightning_sdk.lightning_cloud.openapi.models.versions_version_body import VersionsVersionBody
799
801
  from lightning_sdk.lightning_cloud.openapi.models.works_id_body import WorksIdBody
800
802
  from lightning_sdk.lightning_cloud.openapi.models.v1_image_spec import V1ImageSpec as Gridv1ImageSpec
801
803
  from lightning_sdk.lightning_cloud.openapi.models.clusters_id_body import ClustersIdBody as Body
@@ -148,45 +148,45 @@ class LitRegistryServiceApi(object):
148
148
  _request_timeout=params.get('_request_timeout'),
149
149
  collection_formats=collection_formats)
150
150
 
151
- def lit_registry_service_delete_lit_container(self, project_id: 'str', lit_container_name: 'str', **kwargs) -> 'V1DeleteContainerResponse': # noqa: E501
152
- """lit_registry_service_delete_lit_container # noqa: E501
151
+ def lit_registry_service_delete_lit_repository(self, project_id: 'str', lit_repo_name: 'str', **kwargs) -> 'V1DeleteLitRepositoryResponse': # noqa: E501
152
+ """lit_registry_service_delete_lit_repository # noqa: E501
153
153
 
154
154
  This method makes a synchronous HTTP request by default. To make an
155
155
  asynchronous HTTP request, please pass async_req=True
156
- >>> thread = api.lit_registry_service_delete_lit_container(project_id, lit_container_name, async_req=True)
156
+ >>> thread = api.lit_registry_service_delete_lit_repository(project_id, lit_repo_name, async_req=True)
157
157
  >>> result = thread.get()
158
158
 
159
159
  :param async_req bool
160
160
  :param str project_id: (required)
161
- :param str lit_container_name: (required)
162
- :return: V1DeleteContainerResponse
161
+ :param str lit_repo_name: (required)
162
+ :return: V1DeleteLitRepositoryResponse
163
163
  If the method is called asynchronously,
164
164
  returns the request thread.
165
165
  """
166
166
  kwargs['_return_http_data_only'] = True
167
167
  if kwargs.get('async_req'):
168
- return self.lit_registry_service_delete_lit_container_with_http_info(project_id, lit_container_name, **kwargs) # noqa: E501
168
+ return self.lit_registry_service_delete_lit_repository_with_http_info(project_id, lit_repo_name, **kwargs) # noqa: E501
169
169
  else:
170
- (data) = self.lit_registry_service_delete_lit_container_with_http_info(project_id, lit_container_name, **kwargs) # noqa: E501
170
+ (data) = self.lit_registry_service_delete_lit_repository_with_http_info(project_id, lit_repo_name, **kwargs) # noqa: E501
171
171
  return data
172
172
 
173
- def lit_registry_service_delete_lit_container_with_http_info(self, project_id: 'str', lit_container_name: 'str', **kwargs) -> 'V1DeleteContainerResponse': # noqa: E501
174
- """lit_registry_service_delete_lit_container # noqa: E501
173
+ def lit_registry_service_delete_lit_repository_with_http_info(self, project_id: 'str', lit_repo_name: 'str', **kwargs) -> 'V1DeleteLitRepositoryResponse': # noqa: E501
174
+ """lit_registry_service_delete_lit_repository # noqa: E501
175
175
 
176
176
  This method makes a synchronous HTTP request by default. To make an
177
177
  asynchronous HTTP request, please pass async_req=True
178
- >>> thread = api.lit_registry_service_delete_lit_container_with_http_info(project_id, lit_container_name, async_req=True)
178
+ >>> thread = api.lit_registry_service_delete_lit_repository_with_http_info(project_id, lit_repo_name, async_req=True)
179
179
  >>> result = thread.get()
180
180
 
181
181
  :param async_req bool
182
182
  :param str project_id: (required)
183
- :param str lit_container_name: (required)
184
- :return: V1DeleteContainerResponse
183
+ :param str lit_repo_name: (required)
184
+ :return: V1DeleteLitRepositoryResponse
185
185
  If the method is called asynchronously,
186
186
  returns the request thread.
187
187
  """
188
188
 
189
- all_params = ['project_id', 'lit_container_name'] # noqa: E501
189
+ all_params = ['project_id', 'lit_repo_name'] # noqa: E501
190
190
  all_params.append('async_req')
191
191
  all_params.append('_return_http_data_only')
192
192
  all_params.append('_preload_content')
@@ -197,26 +197,26 @@ class LitRegistryServiceApi(object):
197
197
  if key not in all_params:
198
198
  raise TypeError(
199
199
  "Got an unexpected keyword argument '%s'"
200
- " to method lit_registry_service_delete_lit_container" % key
200
+ " to method lit_registry_service_delete_lit_repository" % key
201
201
  )
202
202
  params[key] = val
203
203
  del params['kwargs']
204
204
  # verify the required parameter 'project_id' is set
205
205
  if ('project_id' not in params or
206
206
  params['project_id'] is None):
207
- raise ValueError("Missing the required parameter `project_id` when calling `lit_registry_service_delete_lit_container`") # noqa: E501
208
- # verify the required parameter 'lit_container_name' is set
209
- if ('lit_container_name' not in params or
210
- params['lit_container_name'] is None):
211
- raise ValueError("Missing the required parameter `lit_container_name` when calling `lit_registry_service_delete_lit_container`") # noqa: E501
207
+ raise ValueError("Missing the required parameter `project_id` when calling `lit_registry_service_delete_lit_repository`") # noqa: E501
208
+ # verify the required parameter 'lit_repo_name' is set
209
+ if ('lit_repo_name' not in params or
210
+ params['lit_repo_name'] is None):
211
+ raise ValueError("Missing the required parameter `lit_repo_name` when calling `lit_registry_service_delete_lit_repository`") # noqa: E501
212
212
 
213
213
  collection_formats = {}
214
214
 
215
215
  path_params = {}
216
216
  if 'project_id' in params:
217
217
  path_params['projectId'] = params['project_id'] # noqa: E501
218
- if 'lit_container_name' in params:
219
- path_params['litContainerName'] = params['lit_container_name'] # noqa: E501
218
+ if 'lit_repo_name' in params:
219
+ path_params['litRepoName'] = params['lit_repo_name'] # noqa: E501
220
220
 
221
221
  query_params = []
222
222
 
@@ -234,14 +234,14 @@ class LitRegistryServiceApi(object):
234
234
  auth_settings = [] # noqa: E501
235
235
 
236
236
  return self.api_client.call_api(
237
- '/v1/projects/{projectId}/lit-registry/{litContainerName}', 'DELETE',
237
+ '/v1/projects/{projectId}/lit-registry/{litRepoName}', 'DELETE',
238
238
  path_params,
239
239
  query_params,
240
240
  header_params,
241
241
  body=body_params,
242
242
  post_params=form_params,
243
243
  files=local_var_files,
244
- response_type='V1DeleteContainerResponse', # noqa: E501
244
+ response_type='V1DeleteLitRepositoryResponse', # noqa: E501
245
245
  auth_settings=auth_settings,
246
246
  async_req=params.get('async_req'),
247
247
  _return_http_data_only=params.get('_return_http_data_only'),
@@ -341,3 +341,104 @@ class LitRegistryServiceApi(object):
341
341
  _preload_content=params.get('_preload_content', True),
342
342
  _request_timeout=params.get('_request_timeout'),
343
343
  collection_formats=collection_formats)
344
+
345
+ def lit_registry_service_get_lit_repository(self, project_id: 'str', lit_repo_name: 'str', **kwargs) -> 'V1LitRepository': # noqa: E501
346
+ """lit_registry_service_get_lit_repository # noqa: E501
347
+
348
+ This method makes a synchronous HTTP request by default. To make an
349
+ asynchronous HTTP request, please pass async_req=True
350
+ >>> thread = api.lit_registry_service_get_lit_repository(project_id, lit_repo_name, async_req=True)
351
+ >>> result = thread.get()
352
+
353
+ :param async_req bool
354
+ :param str project_id: (required)
355
+ :param str lit_repo_name: (required)
356
+ :return: V1LitRepository
357
+ If the method is called asynchronously,
358
+ returns the request thread.
359
+ """
360
+ kwargs['_return_http_data_only'] = True
361
+ if kwargs.get('async_req'):
362
+ return self.lit_registry_service_get_lit_repository_with_http_info(project_id, lit_repo_name, **kwargs) # noqa: E501
363
+ else:
364
+ (data) = self.lit_registry_service_get_lit_repository_with_http_info(project_id, lit_repo_name, **kwargs) # noqa: E501
365
+ return data
366
+
367
+ def lit_registry_service_get_lit_repository_with_http_info(self, project_id: 'str', lit_repo_name: 'str', **kwargs) -> 'V1LitRepository': # noqa: E501
368
+ """lit_registry_service_get_lit_repository # noqa: E501
369
+
370
+ This method makes a synchronous HTTP request by default. To make an
371
+ asynchronous HTTP request, please pass async_req=True
372
+ >>> thread = api.lit_registry_service_get_lit_repository_with_http_info(project_id, lit_repo_name, async_req=True)
373
+ >>> result = thread.get()
374
+
375
+ :param async_req bool
376
+ :param str project_id: (required)
377
+ :param str lit_repo_name: (required)
378
+ :return: V1LitRepository
379
+ If the method is called asynchronously,
380
+ returns the request thread.
381
+ """
382
+
383
+ all_params = ['project_id', 'lit_repo_name'] # noqa: E501
384
+ all_params.append('async_req')
385
+ all_params.append('_return_http_data_only')
386
+ all_params.append('_preload_content')
387
+ all_params.append('_request_timeout')
388
+
389
+ params = locals()
390
+ for key, val in six.iteritems(params['kwargs']):
391
+ if key not in all_params:
392
+ raise TypeError(
393
+ "Got an unexpected keyword argument '%s'"
394
+ " to method lit_registry_service_get_lit_repository" % key
395
+ )
396
+ params[key] = val
397
+ del params['kwargs']
398
+ # verify the required parameter 'project_id' is set
399
+ if ('project_id' not in params or
400
+ params['project_id'] is None):
401
+ raise ValueError("Missing the required parameter `project_id` when calling `lit_registry_service_get_lit_repository`") # noqa: E501
402
+ # verify the required parameter 'lit_repo_name' is set
403
+ if ('lit_repo_name' not in params or
404
+ params['lit_repo_name'] is None):
405
+ raise ValueError("Missing the required parameter `lit_repo_name` when calling `lit_registry_service_get_lit_repository`") # noqa: E501
406
+
407
+ collection_formats = {}
408
+
409
+ path_params = {}
410
+ if 'project_id' in params:
411
+ path_params['projectId'] = params['project_id'] # noqa: E501
412
+ if 'lit_repo_name' in params:
413
+ path_params['litRepoName'] = params['lit_repo_name'] # noqa: E501
414
+
415
+ query_params = []
416
+
417
+ header_params = {}
418
+
419
+ form_params = []
420
+ local_var_files = {}
421
+
422
+ body_params = None
423
+ # HTTP header `Accept`
424
+ header_params['Accept'] = self.api_client.select_header_accept(
425
+ ['application/json']) # noqa: E501
426
+
427
+ # Authentication setting
428
+ auth_settings = [] # noqa: E501
429
+
430
+ return self.api_client.call_api(
431
+ '/v1/projects/{projectId}/lit-registry/{litRepoName}', 'GET',
432
+ path_params,
433
+ query_params,
434
+ header_params,
435
+ body=body_params,
436
+ post_params=form_params,
437
+ files=local_var_files,
438
+ response_type='V1LitRepository', # noqa: E501
439
+ auth_settings=auth_settings,
440
+ async_req=params.get('async_req'),
441
+ _return_http_data_only=params.get('_return_http_data_only'),
442
+ _preload_content=params.get('_preload_content', True),
443
+ _request_timeout=params.get('_request_timeout'),
444
+ collection_formats=collection_formats)