lightning-sdk 0.1.32__py3-none-any.whl → 0.1.34__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 (27) hide show
  1. lightning_sdk/__init__.py +1 -1
  2. lightning_sdk/ai_hub.py +90 -5
  3. lightning_sdk/api/ai_hub_api.py +53 -4
  4. lightning_sdk/api/studio_api.py +15 -8
  5. lightning_sdk/api/utils.py +8 -1
  6. lightning_sdk/cli/ai_hub.py +38 -0
  7. lightning_sdk/cli/entrypoint.py +2 -0
  8. lightning_sdk/lightning_cloud/openapi/__init__.py +1 -0
  9. lightning_sdk/lightning_cloud/openapi/models/__init__.py +1 -0
  10. lightning_sdk/lightning_cloud/openapi/models/create_deployment_request_defines_a_spec_for_the_job_that_allows_for_autoscaling_jobs.py +27 -1
  11. lightning_sdk/lightning_cloud/openapi/models/deployments_id_body.py +27 -1
  12. lightning_sdk/lightning_cloud/openapi/models/v1_checkbox.py +175 -0
  13. lightning_sdk/lightning_cloud/openapi/models/v1_deployment.py +27 -1
  14. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_template_parameter.py +27 -1
  15. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_template_parameter_type.py +1 -0
  16. lightning_sdk/lightning_cloud/openapi/models/v1_job_spec.py +1 -27
  17. lightning_sdk/lightning_cloud/openapi/models/v1_lightningwork_status.py +1 -27
  18. lightning_sdk/lightning_cloud/openapi/models/v1_metric_value.py +27 -1
  19. lightning_sdk/lightning_cloud/openapi/models/v1_usage_details.py +55 -3
  20. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +53 -1
  21. lightning_sdk/studio.py +6 -5
  22. {lightning_sdk-0.1.32.dist-info → lightning_sdk-0.1.34.dist-info}/METADATA +1 -1
  23. {lightning_sdk-0.1.32.dist-info → lightning_sdk-0.1.34.dist-info}/RECORD +27 -25
  24. {lightning_sdk-0.1.32.dist-info → lightning_sdk-0.1.34.dist-info}/LICENSE +0 -0
  25. {lightning_sdk-0.1.32.dist-info → lightning_sdk-0.1.34.dist-info}/WHEEL +0 -0
  26. {lightning_sdk-0.1.32.dist-info → lightning_sdk-0.1.34.dist-info}/entry_points.txt +0 -0
  27. {lightning_sdk-0.1.32.dist-info → lightning_sdk-0.1.34.dist-info}/top_level.txt +0 -0
lightning_sdk/__init__.py CHANGED
@@ -27,5 +27,5 @@ __all__ = [
27
27
  "AIHub",
28
28
  ]
29
29
 
30
- __version__ = "0.1.32"
30
+ __version__ = "0.1.34"
31
31
  _check_version_and_prompt_upgrade(__version__)
lightning_sdk/ai_hub.py CHANGED
@@ -1,6 +1,14 @@
1
- from typing import Dict, List
1
+ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
2
+ from urllib.parse import quote
2
3
 
3
- from lightning_sdk.api.ai_hub_api import AIHubApi
4
+ from lightning_sdk.api import AIHubApi, UserApi
5
+ from lightning_sdk.lightning_cloud import login
6
+ from lightning_sdk.lightning_cloud.env import LIGHTNING_CLOUD_URL
7
+ from lightning_sdk.user import User
8
+ from lightning_sdk.utils.resolve import _resolve_org, _resolve_teamspace
9
+
10
+ if TYPE_CHECKING:
11
+ from lightning_sdk import Organization, Teamspace
4
12
 
5
13
 
6
14
  class AIHub:
@@ -13,10 +21,17 @@ class AIHub:
13
21
 
14
22
  def __init__(self) -> None:
15
23
  self._api = AIHubApi()
24
+ self._auth = None
25
+
26
+ def list_apis(self, search: Optional[str] = None) -> List[Dict[str, str]]:
27
+ """Get a list of AI Hub API templates.
16
28
 
17
- def list_apis(self) -> List[Dict[str, str]]:
18
- """Get a list of AI Hub API templates."""
19
- api_templates = self._api.list_apis()
29
+ Example:
30
+ api_hub = AIHub()
31
+ api_list = api_hub.list_apis(search="Llama")
32
+ """
33
+ search_query = search or ""
34
+ api_templates = self._api.list_apis(search_query=search_query)
20
35
  results = []
21
36
  for template in api_templates:
22
37
  result = {
@@ -24,6 +39,76 @@ class AIHub:
24
39
  "name": template.name,
25
40
  "description": template.description,
26
41
  "creator_username": template.creator_username,
42
+ "created_on": template.creation_timestamp.strftime("%Y-%m-%d %H:%M:%S")
43
+ if template.creation_timestamp
44
+ else None,
27
45
  }
28
46
  results.append(result)
29
47
  return results
48
+
49
+ def _authenticate(
50
+ self,
51
+ teamspace: Optional[Union[str, "Teamspace"]] = None,
52
+ org: Optional[Union[str, "Organization"]] = None,
53
+ user: Optional[Union[str, "User"]] = None,
54
+ ) -> "Teamspace":
55
+ if self._auth is None:
56
+ self._auth = login.Auth()
57
+ try:
58
+ self._auth.authenticate()
59
+ user = User(name=UserApi()._get_user_by_id(self._auth.user_id).username)
60
+ except ConnectionError as e:
61
+ raise e
62
+
63
+ org = _resolve_org(org)
64
+ teamspace = _resolve_teamspace(teamspace=teamspace, org=org, user=user if org is None else None)
65
+ if teamspace is None:
66
+ raise ValueError("You need to pass a teamspace or an org for your deployment.")
67
+ return teamspace
68
+
69
+ def deploy(
70
+ self,
71
+ api_id: str,
72
+ cluster: Optional[str] = None,
73
+ name: Optional[str] = None,
74
+ teamspace: Optional[Union[str, "Teamspace"]] = None,
75
+ org: Optional[Union[str, "Organization"]] = None,
76
+ **kwargs: Dict[str, Any],
77
+ ) -> Dict[str, Union[str, bool]]:
78
+ """Deploy an API from the AI Hub.
79
+
80
+ Example:
81
+ from lightning_sdk import AIHub
82
+ ai_hub = AIHub()
83
+ deployment = ai_hub.deploy("temp_01jc37n6qpqkdptjpyep0z06hy", batch_size=10)
84
+
85
+ Args:
86
+ api_id: The ID of the API you want to deploy.
87
+ cluster: The cluster where you want to deploy the API, such as "lightning-public-prod".
88
+ name: Name for the deployed API. Defaults to None.
89
+ teamspace: The team or group for deployment. Defaults to None.
90
+ org: The organization for deployment. Defaults to None.
91
+ **kwargs: Additional keyword arguments for deployment.
92
+
93
+ Returns:
94
+ A dictionary containing the name of the deployed API,
95
+ the URL to access it, and whether it is interruptible.
96
+
97
+ Raises:
98
+ ValueError: If a teamspace or organization is not provided.
99
+ ConnectionError: If there is an issue with logging in.
100
+ """
101
+ teamspace = self._authenticate(teamspace, org)
102
+ teamspace_id = teamspace.id
103
+
104
+ deployment = self._api.deploy_api(
105
+ template_id=api_id, cluster_id=cluster, project_id=teamspace_id, name=name, **kwargs
106
+ )
107
+ url = quote(f"{LIGHTNING_CLOUD_URL}/{teamspace._org.name}/{teamspace.name}/jobs/{deployment.name}", safe=":/()")
108
+ print("Deployment available at:", url)
109
+ return {
110
+ "id": deployment.id,
111
+ "name": deployment.name,
112
+ "base_url": deployment.status.urls[0],
113
+ "interruptible": deployment.spec.spot,
114
+ }
@@ -1,5 +1,13 @@
1
- from typing import List
1
+ import re
2
+ from typing import List, Optional
2
3
 
4
+ import backoff
5
+
6
+ from lightning_sdk.lightning_cloud.openapi.models import (
7
+ CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs,
8
+ V1Deployment,
9
+ V1ParameterizationSpec,
10
+ )
3
11
  from lightning_sdk.lightning_cloud.openapi.models.v1_deployment_template_gallery_response import (
4
12
  V1DeploymentTemplateGalleryResponse,
5
13
  )
@@ -8,8 +16,49 @@ from lightning_sdk.lightning_cloud.rest_client import LightningClient
8
16
 
9
17
  class AIHubApi:
10
18
  def __init__(self) -> None:
11
- self._client = LightningClient(max_tries=7)
19
+ self._client = LightningClient(max_tries=3)
12
20
 
13
- def list_apis(self) -> List[V1DeploymentTemplateGalleryResponse]:
21
+ @backoff.on_predicate(backoff.expo, lambda x: not x, max_tries=5)
22
+ def list_apis(self, search_query: str) -> List[V1DeploymentTemplateGalleryResponse]:
14
23
  kwargs = {"show_globally_visible": True}
15
- return self._client.deployment_templates_service_list_published_deployment_templates(**kwargs).templates
24
+ return self._client.deployment_templates_service_list_published_deployment_templates(
25
+ search_query=search_query, **kwargs
26
+ ).templates
27
+
28
+ @staticmethod
29
+ def _parse_and_update_args(cmd: str, **kwargs: dict) -> list:
30
+ """Parse the command and update the arguments with the provided kwargs.
31
+
32
+ >>> _parse_and_update_args("--arg1 1 --arg2=2", arg1=3)
33
+ ['--arg1 3']
34
+ """
35
+ keys = [key.lstrip("-") for key in re.findall(r"--\w+", cmd)]
36
+ arguments = {}
37
+ for key in keys:
38
+ if key in kwargs:
39
+ arguments[key] = kwargs[key]
40
+ return [f"--{k} {v}" for k, v in arguments.items()]
41
+
42
+ @staticmethod
43
+ def _resolve_api_arguments(parameter_spec: "V1ParameterizationSpec", **kwargs: dict) -> str:
44
+ return " ".join(AIHubApi._parse_and_update_args(parameter_spec.command, **kwargs))
45
+
46
+ def deploy_api(
47
+ self, template_id: str, project_id: str, cluster_id: str, name: Optional[str], **kwargs: dict
48
+ ) -> V1Deployment:
49
+ template = self._client.deployment_templates_service_get_deployment_template(template_id)
50
+ name = name or template.name
51
+ template.spec_v2.endpoint.id = None
52
+ command = self._resolve_api_arguments(template.parameter_spec, **kwargs)
53
+ template.spec_v2.job.command = command
54
+ return self._client.jobs_service_create_deployment(
55
+ project_id=project_id,
56
+ body=CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs(
57
+ autoscaling=template.spec_v2.autoscaling,
58
+ cluster_id=cluster_id,
59
+ endpoint=template.spec_v2.endpoint,
60
+ name=name,
61
+ replicas=0,
62
+ spec=template.spec_v2.job,
63
+ ),
64
+ )
@@ -5,7 +5,7 @@ import time
5
5
  import warnings
6
6
  import zipfile
7
7
  from threading import Event, Thread
8
- from typing import Any, Dict, Mapping, Optional, Tuple
8
+ from typing import Any, Dict, Mapping, Optional, Tuple, Union
9
9
 
10
10
  import backoff
11
11
  import requests
@@ -18,6 +18,7 @@ from lightning_sdk.api.utils import (
18
18
  _DummyBody,
19
19
  _DummyResponse,
20
20
  _FileUploader,
21
+ _machine_to_compute_name,
21
22
  _sanitize_studio_remote_path,
22
23
  )
23
24
  from lightning_sdk.api.utils import (
@@ -146,9 +147,11 @@ class StudioApi:
146
147
  """Retries checking the sync_in_progress value of the code status when there's an AttributeError."""
147
148
  return self.get_studio_status(studio_id, teamspace_id).in_use.sync_in_progress
148
149
 
149
- def start_studio(self, studio_id: str, teamspace_id: str, machine: Machine, interruptible: False) -> None:
150
+ def start_studio(
151
+ self, studio_id: str, teamspace_id: str, machine: Union[Machine, str], interruptible: False
152
+ ) -> None:
150
153
  """Start an existing Studio."""
151
- if machine == Machine.CPU_SMALL:
154
+ if _machine_to_compute_name(machine) == _machine_to_compute_name(Machine.CPU_SMALL):
152
155
  warnings.warn(
153
156
  f"{Machine.CPU_SMALL} is not a valid machine for starting a Studio. "
154
157
  "It is reserved for running jobs only. "
@@ -158,7 +161,7 @@ class StudioApi:
158
161
 
159
162
  self._client.cloud_space_service_start_cloud_space_instance(
160
163
  IdStartBody(
161
- compute_config=V1UserRequestedComputeConfig(name=_MACHINE_TO_COMPUTE_NAME[machine], spot=interruptible)
164
+ compute_config=V1UserRequestedComputeConfig(name=_machine_to_compute_name(machine), spot=interruptible)
162
165
  ),
163
166
  teamspace_id,
164
167
  studio_id,
@@ -204,9 +207,11 @@ class StudioApi:
204
207
  def _get_studio_instance_status_from_object(self, studio: V1CloudSpace) -> Optional[str]:
205
208
  return getattr(getattr(studio.code_status, "in_use", None), "phase", None)
206
209
 
207
- def _request_switch(self, studio_id: str, teamspace_id: str, machine: Machine, interruptible: bool) -> None:
210
+ def _request_switch(
211
+ self, studio_id: str, teamspace_id: str, machine: Union[Machine, str], interruptible: bool
212
+ ) -> None:
208
213
  """Switches given Studio to a new machine type."""
209
- if machine == Machine.CPU_SMALL:
214
+ if _machine_to_compute_name(machine) == _machine_to_compute_name(Machine.CPU_SMALL):
210
215
  warnings.warn(
211
216
  f"{Machine.CPU_SMALL} is not a valid machine for switching a Studio. "
212
217
  "It is reserved for running jobs only. "
@@ -214,7 +219,7 @@ class StudioApi:
214
219
  )
215
220
  machine = Machine.CPU
216
221
 
217
- compute_name = _MACHINE_TO_COMPUTE_NAME[machine]
222
+ compute_name = _machine_to_compute_name(machine)
218
223
  # TODO: UI sends disk size here, maybe we need to also?
219
224
  body = IdCodeconfigBody(compute_config=V1UserRequestedComputeConfig(name=compute_name, spot=interruptible))
220
225
  self._client.cloud_space_service_update_cloud_space_instance_config(
@@ -223,7 +228,9 @@ class StudioApi:
223
228
  body=body,
224
229
  )
225
230
 
226
- def switch_studio_machine(self, studio_id: str, teamspace_id: str, machine: Machine, interruptible: bool) -> None:
231
+ def switch_studio_machine(
232
+ self, studio_id: str, teamspace_id: str, machine: Union[Machine, str], interruptible: bool
233
+ ) -> None:
227
234
  """Switches given Studio to a new machine type."""
228
235
  self._request_switch(
229
236
  studio_id=studio_id, teamspace_id=teamspace_id, machine=machine, interruptible=interruptible
@@ -4,7 +4,7 @@ import os
4
4
  from concurrent.futures import ThreadPoolExecutor
5
5
  from functools import partial
6
6
  from pathlib import Path
7
- from typing import Any, Dict, List, Optional, Tuple
7
+ from typing import Any, Dict, List, Optional, Tuple, Union
8
8
 
9
9
  import backoff
10
10
  import requests
@@ -340,6 +340,13 @@ _MACHINE_TO_COMPUTE_NAME: Dict[Machine, str] = {
340
340
  Machine.H200_X_8: "p5e.48xlarge",
341
341
  }
342
342
 
343
+
344
+ def _machine_to_compute_name(machine: Union[Machine, str]) -> str:
345
+ if isinstance(machine, Machine):
346
+ return _MACHINE_TO_COMPUTE_NAME[machine]
347
+ return machine
348
+
349
+
343
350
  _COMPUTE_NAME_TO_MACHINE: Dict[str, Machine] = {v: k for k, v in _MACHINE_TO_COMPUTE_NAME.items()}
344
351
 
345
352
  _DEFAULT_CLOUD_URL = "https://lightning.ai:443"
@@ -0,0 +1,38 @@
1
+ from typing import List, Optional
2
+
3
+ from lightning_sdk.ai_hub import AIHub
4
+ from lightning_sdk.cli.studios_menu import _StudiosMenu
5
+
6
+
7
+ class _AIHub(_StudiosMenu):
8
+ """Interact with Lightning Studio - AI Hub."""
9
+
10
+ def __init__(self) -> None:
11
+ self._hub = AIHub()
12
+
13
+ def list_apis(self, search: Optional[str] = None) -> List[dict]:
14
+ """List API templates available in the AI Hub.
15
+
16
+ Args:
17
+ search: Search for API templates by name.
18
+ """
19
+ return self._hub.list_apis(search=search)
20
+
21
+ def deploy(
22
+ self,
23
+ api_id: str,
24
+ cluster: Optional[str] = None,
25
+ name: Optional[str] = None,
26
+ teamspace: Optional[str] = None,
27
+ org: Optional[str] = None,
28
+ ) -> dict:
29
+ """Deploy an API template from the AI Hub.
30
+
31
+ Args:
32
+ api_id: API template ID.
33
+ cluster: Cluster to deploy the API to. Defaults to user's default cluster.
34
+ name: Name of the deployed API. Defaults to the name of the API template.
35
+ teamspace: Teamspace to deploy the API to. Defaults to user's default teamspace.
36
+ org: Organization to deploy the API to. Defaults to user's default organization.
37
+ """
38
+ return self._hub.deploy(api_id, cluster=cluster, name=name, teamspace=teamspace, org=org)
@@ -2,6 +2,7 @@ from fire import Fire
2
2
  from lightning_utilities.core.imports import RequirementCache
3
3
 
4
4
  from lightning_sdk.api.studio_api import _cloud_url
5
+ from lightning_sdk.cli.ai_hub import _AIHub
5
6
  from lightning_sdk.cli.download import _Downloads
6
7
  from lightning_sdk.cli.legacy import _LegacyLightningCLI
7
8
  from lightning_sdk.cli.upload import _Uploads
@@ -16,6 +17,7 @@ class StudioCLI:
16
17
  def __init__(self) -> None:
17
18
  self.download = _Downloads()
18
19
  self.upload = _Uploads()
20
+ self.aihub = _AIHub()
19
21
 
20
22
  if _LIGHTNING_AVAILABLE:
21
23
  self.run = _LegacyLightningCLI()
@@ -226,6 +226,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_cancellation_metadata impor
226
226
  from lightning_sdk.lightning_cloud.openapi.models.v1_capacity_block_offering import V1CapacityBlockOffering
227
227
  from lightning_sdk.lightning_cloud.openapi.models.v1_check_external_service_status_response import V1CheckExternalServiceStatusResponse
228
228
  from lightning_sdk.lightning_cloud.openapi.models.v1_check_snowflake_connection_response import V1CheckSnowflakeConnectionResponse
229
+ from lightning_sdk.lightning_cloud.openapi.models.v1_checkbox import V1Checkbox
229
230
  from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space import V1CloudSpace
230
231
  from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_app import V1CloudSpaceApp
231
232
  from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_app_action import V1CloudSpaceAppAction
@@ -190,6 +190,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_cancellation_metadata impor
190
190
  from lightning_sdk.lightning_cloud.openapi.models.v1_capacity_block_offering import V1CapacityBlockOffering
191
191
  from lightning_sdk.lightning_cloud.openapi.models.v1_check_external_service_status_response import V1CheckExternalServiceStatusResponse
192
192
  from lightning_sdk.lightning_cloud.openapi.models.v1_check_snowflake_connection_response import V1CheckSnowflakeConnectionResponse
193
+ from lightning_sdk.lightning_cloud.openapi.models.v1_checkbox import V1Checkbox
193
194
  from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space import V1CloudSpace
194
195
  from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_app import V1CloudSpaceApp
195
196
  from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_app_action import V1CloudSpaceAppAction
@@ -45,6 +45,7 @@ class CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs(o
45
45
  'cluster_id': 'str',
46
46
  'endpoint': 'V1Endpoint',
47
47
  'name': 'str',
48
+ 'parameter_spec': 'V1ParameterizationSpec',
48
49
  'replicas': 'int',
49
50
  'spec': 'V1JobSpec',
50
51
  'strategy': 'V1DeploymentStrategy'
@@ -55,17 +56,19 @@ class CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs(o
55
56
  'cluster_id': 'clusterId',
56
57
  'endpoint': 'endpoint',
57
58
  'name': 'name',
59
+ 'parameter_spec': 'parameterSpec',
58
60
  'replicas': 'replicas',
59
61
  'spec': 'spec',
60
62
  'strategy': 'strategy'
61
63
  }
62
64
 
63
- def __init__(self, autoscaling: 'V1AutoscalingSpec' =None, cluster_id: 'str' =None, endpoint: 'V1Endpoint' =None, name: 'str' =None, replicas: 'int' =None, spec: 'V1JobSpec' =None, strategy: 'V1DeploymentStrategy' =None): # noqa: E501
65
+ def __init__(self, autoscaling: 'V1AutoscalingSpec' =None, cluster_id: 'str' =None, endpoint: 'V1Endpoint' =None, name: 'str' =None, parameter_spec: 'V1ParameterizationSpec' =None, replicas: 'int' =None, spec: 'V1JobSpec' =None, strategy: 'V1DeploymentStrategy' =None): # noqa: E501
64
66
  """CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs - a model defined in Swagger""" # noqa: E501
65
67
  self._autoscaling = None
66
68
  self._cluster_id = None
67
69
  self._endpoint = None
68
70
  self._name = None
71
+ self._parameter_spec = None
69
72
  self._replicas = None
70
73
  self._spec = None
71
74
  self._strategy = None
@@ -78,6 +81,8 @@ class CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs(o
78
81
  self.endpoint = endpoint
79
82
  if name is not None:
80
83
  self.name = name
84
+ if parameter_spec is not None:
85
+ self.parameter_spec = parameter_spec
81
86
  if replicas is not None:
82
87
  self.replicas = replicas
83
88
  if spec is not None:
@@ -169,6 +174,27 @@ class CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs(o
169
174
 
170
175
  self._name = name
171
176
 
177
+ @property
178
+ def parameter_spec(self) -> 'V1ParameterizationSpec':
179
+ """Gets the parameter_spec of this CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs. # noqa: E501
180
+
181
+
182
+ :return: The parameter_spec of this CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs. # noqa: E501
183
+ :rtype: V1ParameterizationSpec
184
+ """
185
+ return self._parameter_spec
186
+
187
+ @parameter_spec.setter
188
+ def parameter_spec(self, parameter_spec: 'V1ParameterizationSpec'):
189
+ """Sets the parameter_spec of this CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs.
190
+
191
+
192
+ :param parameter_spec: The parameter_spec of this CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs. # noqa: E501
193
+ :type: V1ParameterizationSpec
194
+ """
195
+
196
+ self._parameter_spec = parameter_spec
197
+
172
198
  @property
173
199
  def replicas(self) -> 'int':
174
200
  """Gets the replicas of this CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs. # noqa: E501
@@ -47,6 +47,7 @@ class DeploymentsIdBody(object):
47
47
  'endpoint': 'V1Endpoint',
48
48
  'is_published': 'bool',
49
49
  'name': 'str',
50
+ 'parameter_spec': 'V1ParameterizationSpec',
50
51
  'release_id': 'str',
51
52
  'replicas': 'int',
52
53
  'spec': 'V1JobSpec',
@@ -63,6 +64,7 @@ class DeploymentsIdBody(object):
63
64
  'endpoint': 'endpoint',
64
65
  'is_published': 'isPublished',
65
66
  'name': 'name',
67
+ 'parameter_spec': 'parameterSpec',
66
68
  'release_id': 'releaseId',
67
69
  'replicas': 'replicas',
68
70
  'spec': 'spec',
@@ -72,7 +74,7 @@ class DeploymentsIdBody(object):
72
74
  'user_id': 'userId'
73
75
  }
74
76
 
75
- def __init__(self, autoscaling: 'V1AutoscalingSpec' =None, created_at: 'datetime' =None, desired_state: 'V1DeploymentState' =None, endpoint: 'V1Endpoint' =None, is_published: 'bool' =None, name: 'str' =None, release_id: 'str' =None, replicas: 'int' =None, spec: 'V1JobSpec' =None, status: 'V1DeploymentStatus' =None, strategy: 'V1DeploymentStrategy' =None, updated_at: 'datetime' =None, user_id: 'str' =None): # noqa: E501
77
+ def __init__(self, autoscaling: 'V1AutoscalingSpec' =None, created_at: 'datetime' =None, desired_state: 'V1DeploymentState' =None, endpoint: 'V1Endpoint' =None, is_published: 'bool' =None, name: 'str' =None, parameter_spec: 'V1ParameterizationSpec' =None, release_id: 'str' =None, replicas: 'int' =None, spec: 'V1JobSpec' =None, status: 'V1DeploymentStatus' =None, strategy: 'V1DeploymentStrategy' =None, updated_at: 'datetime' =None, user_id: 'str' =None): # noqa: E501
76
78
  """DeploymentsIdBody - a model defined in Swagger""" # noqa: E501
77
79
  self._autoscaling = None
78
80
  self._created_at = None
@@ -80,6 +82,7 @@ class DeploymentsIdBody(object):
80
82
  self._endpoint = None
81
83
  self._is_published = None
82
84
  self._name = None
85
+ self._parameter_spec = None
83
86
  self._release_id = None
84
87
  self._replicas = None
85
88
  self._spec = None
@@ -100,6 +103,8 @@ class DeploymentsIdBody(object):
100
103
  self.is_published = is_published
101
104
  if name is not None:
102
105
  self.name = name
106
+ if parameter_spec is not None:
107
+ self.parameter_spec = parameter_spec
103
108
  if release_id is not None:
104
109
  self.release_id = release_id
105
110
  if replicas is not None:
@@ -241,6 +246,27 @@ class DeploymentsIdBody(object):
241
246
 
242
247
  self._name = name
243
248
 
249
+ @property
250
+ def parameter_spec(self) -> 'V1ParameterizationSpec':
251
+ """Gets the parameter_spec of this DeploymentsIdBody. # noqa: E501
252
+
253
+
254
+ :return: The parameter_spec of this DeploymentsIdBody. # noqa: E501
255
+ :rtype: V1ParameterizationSpec
256
+ """
257
+ return self._parameter_spec
258
+
259
+ @parameter_spec.setter
260
+ def parameter_spec(self, parameter_spec: 'V1ParameterizationSpec'):
261
+ """Sets the parameter_spec of this DeploymentsIdBody.
262
+
263
+
264
+ :param parameter_spec: The parameter_spec of this DeploymentsIdBody. # noqa: E501
265
+ :type: V1ParameterizationSpec
266
+ """
267
+
268
+ self._parameter_spec = parameter_spec
269
+
244
270
  @property
245
271
  def release_id(self) -> 'str':
246
272
  """Gets the release_id of this DeploymentsIdBody. # noqa: E501
@@ -0,0 +1,175 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ external/v1/auth_service.proto
5
+
6
+ No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
7
+
8
+ OpenAPI spec version: version not set
9
+
10
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
11
+
12
+ NOTE
13
+ ----
14
+ standard swagger-codegen-cli for this python client has been modified
15
+ by custom templates. The purpose of these templates is to include
16
+ typing information in the API and Model code. Please refer to the
17
+ main grid repository for more info
18
+ """
19
+
20
+ import pprint
21
+ import re # noqa: F401
22
+
23
+ from typing import TYPE_CHECKING
24
+
25
+ import six
26
+
27
+ if TYPE_CHECKING:
28
+ from datetime import datetime
29
+ from lightning_sdk.lightning_cloud.openapi.models import *
30
+
31
+ class V1Checkbox(object):
32
+ """NOTE: This class is auto generated by the swagger code generator program.
33
+
34
+ Do not edit the class manually.
35
+ """
36
+ """
37
+ Attributes:
38
+ swagger_types (dict): The key is attribute name
39
+ and the value is attribute type.
40
+ attribute_map (dict): The key is attribute name
41
+ and the value is json key in definition.
42
+ """
43
+ swagger_types = {
44
+ 'false_value': 'str',
45
+ 'is_checked': 'bool',
46
+ 'true_value': 'str'
47
+ }
48
+
49
+ attribute_map = {
50
+ 'false_value': 'falseValue',
51
+ 'is_checked': 'isChecked',
52
+ 'true_value': 'trueValue'
53
+ }
54
+
55
+ def __init__(self, false_value: 'str' =None, is_checked: 'bool' =None, true_value: 'str' =None): # noqa: E501
56
+ """V1Checkbox - a model defined in Swagger""" # noqa: E501
57
+ self._false_value = None
58
+ self._is_checked = None
59
+ self._true_value = None
60
+ self.discriminator = None
61
+ if false_value is not None:
62
+ self.false_value = false_value
63
+ if is_checked is not None:
64
+ self.is_checked = is_checked
65
+ if true_value is not None:
66
+ self.true_value = true_value
67
+
68
+ @property
69
+ def false_value(self) -> 'str':
70
+ """Gets the false_value of this V1Checkbox. # noqa: E501
71
+
72
+
73
+ :return: The false_value of this V1Checkbox. # noqa: E501
74
+ :rtype: str
75
+ """
76
+ return self._false_value
77
+
78
+ @false_value.setter
79
+ def false_value(self, false_value: 'str'):
80
+ """Sets the false_value of this V1Checkbox.
81
+
82
+
83
+ :param false_value: The false_value of this V1Checkbox. # noqa: E501
84
+ :type: str
85
+ """
86
+
87
+ self._false_value = false_value
88
+
89
+ @property
90
+ def is_checked(self) -> 'bool':
91
+ """Gets the is_checked of this V1Checkbox. # noqa: E501
92
+
93
+
94
+ :return: The is_checked of this V1Checkbox. # noqa: E501
95
+ :rtype: bool
96
+ """
97
+ return self._is_checked
98
+
99
+ @is_checked.setter
100
+ def is_checked(self, is_checked: 'bool'):
101
+ """Sets the is_checked of this V1Checkbox.
102
+
103
+
104
+ :param is_checked: The is_checked of this V1Checkbox. # noqa: E501
105
+ :type: bool
106
+ """
107
+
108
+ self._is_checked = is_checked
109
+
110
+ @property
111
+ def true_value(self) -> 'str':
112
+ """Gets the true_value of this V1Checkbox. # noqa: E501
113
+
114
+
115
+ :return: The true_value of this V1Checkbox. # noqa: E501
116
+ :rtype: str
117
+ """
118
+ return self._true_value
119
+
120
+ @true_value.setter
121
+ def true_value(self, true_value: 'str'):
122
+ """Sets the true_value of this V1Checkbox.
123
+
124
+
125
+ :param true_value: The true_value of this V1Checkbox. # noqa: E501
126
+ :type: str
127
+ """
128
+
129
+ self._true_value = true_value
130
+
131
+ def to_dict(self) -> dict:
132
+ """Returns the model properties as a dict"""
133
+ result = {}
134
+
135
+ for attr, _ in six.iteritems(self.swagger_types):
136
+ value = getattr(self, attr)
137
+ if isinstance(value, list):
138
+ result[attr] = list(map(
139
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
140
+ value
141
+ ))
142
+ elif hasattr(value, "to_dict"):
143
+ result[attr] = value.to_dict()
144
+ elif isinstance(value, dict):
145
+ result[attr] = dict(map(
146
+ lambda item: (item[0], item[1].to_dict())
147
+ if hasattr(item[1], "to_dict") else item,
148
+ value.items()
149
+ ))
150
+ else:
151
+ result[attr] = value
152
+ if issubclass(V1Checkbox, dict):
153
+ for key, value in self.items():
154
+ result[key] = value
155
+
156
+ return result
157
+
158
+ def to_str(self) -> str:
159
+ """Returns the string representation of the model"""
160
+ return pprint.pformat(self.to_dict())
161
+
162
+ def __repr__(self) -> str:
163
+ """For `print` and `pprint`"""
164
+ return self.to_str()
165
+
166
+ def __eq__(self, other: 'V1Checkbox') -> bool:
167
+ """Returns true if both objects are equal"""
168
+ if not isinstance(other, V1Checkbox):
169
+ return False
170
+
171
+ return self.__dict__ == other.__dict__
172
+
173
+ def __ne__(self, other: 'V1Checkbox') -> bool:
174
+ """Returns true if both objects are not equal"""
175
+ return not self == other