platform-api-python-client 4.31.0__py3-none-any.whl → 4.37.1__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 (70) hide show
  1. platform_api_python_client/__init__.py +39 -10
  2. platform_api_python_client/api/external_api.py +6460 -1203
  3. platform_api_python_client/api_client.py +1 -1
  4. platform_api_python_client/configuration.py +1 -1
  5. platform_api_python_client/models/__init__.py +38 -9
  6. platform_api_python_client/models/ccl_dynamo_pools.py +116 -0
  7. platform_api_python_client/models/{create_c_serve_v2_deployment_response.py → ccl_main_pools.py} +12 -13
  8. platform_api_python_client/models/cluster_credential.py +2 -2
  9. platform_api_python_client/models/create_compute_deployment_request.py +27 -1
  10. platform_api_python_client/models/create_dynamo_deployment_request.py +42 -1
  11. platform_api_python_client/models/create_filesystem_volume_request.py +0 -13
  12. platform_api_python_client/models/create_inference_v3_deployment_request.py +42 -2
  13. platform_api_python_client/models/create_job_deployment_request.py +27 -1
  14. platform_api_python_client/models/create_object_volume_request.py +0 -13
  15. platform_api_python_client/models/deployment_response.py +12 -27
  16. platform_api_python_client/models/deployment_type.py +14 -0
  17. platform_api_python_client/models/dynamo_communications_input.py +0 -13
  18. platform_api_python_client/models/dynamo_communications_output.py +0 -13
  19. platform_api_python_client/models/dynamo_image.py +105 -0
  20. platform_api_python_client/models/dynamo_kv_transfer_configuration.py +0 -13
  21. platform_api_python_client/models/dynamo_weight_transfer_configuration.py +88 -0
  22. platform_api_python_client/models/dynamo_weight_transfer_policy.py +36 -0
  23. platform_api_python_client/models/dynamo_worker_pool_config.py +1 -14
  24. platform_api_python_client/models/dynamo_worker_pools.py +0 -13
  25. platform_api_python_client/models/env.py +89 -0
  26. platform_api_python_client/models/get_cluster_response.py +4 -2
  27. platform_api_python_client/models/get_compute_deployment_response.py +29 -2
  28. platform_api_python_client/models/get_deployment_usage_response.py +19 -4
  29. platform_api_python_client/models/get_dynamo_deployment_response.py +43 -1
  30. platform_api_python_client/models/get_inference_v3_deployment_response.py +43 -2
  31. platform_api_python_client/models/get_job_deployment_response.py +29 -2
  32. platform_api_python_client/models/hardware_instance_response.py +6 -2
  33. platform_api_python_client/models/image.py +112 -0
  34. platform_api_python_client/models/ingress.py +103 -0
  35. platform_api_python_client/models/insight_list_item_response.py +108 -0
  36. platform_api_python_client/models/insight_resource.py +97 -0
  37. platform_api_python_client/models/insight_resource_type.py +37 -0
  38. platform_api_python_client/models/insight_response.py +133 -0
  39. platform_api_python_client/models/insight_severity.py +40 -0
  40. platform_api_python_client/models/insight_status.py +39 -0
  41. platform_api_python_client/models/{c_serve_recipe_response.py → insight_status_change_response.py} +28 -24
  42. platform_api_python_client/models/{c_serve_recipe_perf.py → list_insights_response.py} +16 -19
  43. platform_api_python_client/models/metric.py +13 -0
  44. platform_api_python_client/models/pool.py +116 -0
  45. platform_api_python_client/models/{get_c_serve_v2_deployment_response.py → unified_get_compute_deployment_response.py} +65 -81
  46. platform_api_python_client/models/unified_get_deployment_logs_response.py +95 -0
  47. platform_api_python_client/models/{create_c_serve_v3_deployment_response.py → unified_get_deployment_pods_response.py} +8 -13
  48. platform_api_python_client/models/unified_get_deployment_response.py +164 -0
  49. platform_api_python_client/models/unified_get_deployment_revision_response.py +109 -0
  50. platform_api_python_client/models/unified_get_deployment_rollout_response.py +90 -0
  51. platform_api_python_client/models/unified_get_deployment_usage_response.py +110 -0
  52. platform_api_python_client/models/unified_get_dynamo_deployment_response.py +218 -0
  53. platform_api_python_client/models/unified_get_inference_v3_deployment_response.py +228 -0
  54. platform_api_python_client/models/{get_c_serve_v3_deployment_response.py → unified_get_job_deployment_response.py} +85 -75
  55. platform_api_python_client/models/{list_c_serve_recipe_response.py → unified_list_deployment_revisions_response.py} +7 -7
  56. platform_api_python_client/models/unified_update_deployment_rollout_request.py +87 -0
  57. platform_api_python_client/models/unified_write_compute_deployment_request.py +154 -0
  58. platform_api_python_client/models/unified_write_deployment_request.py +164 -0
  59. platform_api_python_client/models/{c_serve_v2_recipe.py → unified_write_deployment_response.py} +27 -27
  60. platform_api_python_client/models/unified_write_dynamo_deployment_request.py +197 -0
  61. platform_api_python_client/models/{create_c_serve_v3_deployment_request.py → unified_write_inference_v3_deployment_request.py} +78 -70
  62. platform_api_python_client/models/unified_write_job_deployment_request.py +183 -0
  63. platform_api_python_client/models/update_insight_status_request.py +106 -0
  64. platform_api_python_client/models/upsert_user_vault_item_request.py +1 -1
  65. platform_api_python_client/models/usage_availability.py +40 -0
  66. platform_api_python_client/models/usage_component.py +39 -0
  67. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.37.1.dist-info}/METADATA +1 -1
  68. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.37.1.dist-info}/RECORD +70 -41
  69. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.37.1.dist-info}/WHEEL +1 -1
  70. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.37.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,133 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from platform_api_python_client.models.insight_resource import InsightResource
24
+ from platform_api_python_client.models.insight_severity import InsightSeverity
25
+ from platform_api_python_client.models.insight_status import InsightStatus
26
+ from platform_api_python_client.models.insight_status_change_response import InsightStatusChangeResponse
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class InsightResponse(BaseModel):
31
+ """
32
+ InsightResponse
33
+ """ # noqa: E501
34
+ id: StrictInt
35
+ identity: StrictStr = Field(description="Human-readable identifier, e.g. INSIGHT-42")
36
+ severity: InsightSeverity
37
+ status: InsightStatus
38
+ title: StrictStr
39
+ observed_at: datetime
40
+ created_at: datetime
41
+ resource: InsightResource
42
+ observed_summary: StrictStr
43
+ recommended_steps: StrictStr
44
+ content: Optional[StrictStr] = None
45
+ reported_by: StrictStr = Field(description="Name of the user that reported it; a service account shows its creator")
46
+ updated_at: datetime
47
+ history: List[InsightStatusChangeResponse] = Field(description="Status changes, newest first")
48
+ __properties: ClassVar[List[str]] = ["id", "identity", "severity", "status", "title", "observed_at", "created_at", "resource", "observed_summary", "recommended_steps", "content", "reported_by", "updated_at", "history"]
49
+
50
+ model_config = ConfigDict(
51
+ populate_by_name=True,
52
+ validate_assignment=True,
53
+ protected_namespaces=(),
54
+ )
55
+
56
+
57
+ def to_str(self) -> str:
58
+ """Returns the string representation of the model using alias"""
59
+ return pprint.pformat(self.model_dump(by_alias=True))
60
+
61
+ def to_json(self) -> str:
62
+ """Returns the JSON representation of the model using alias"""
63
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
+ return json.dumps(self.to_dict())
65
+
66
+ @classmethod
67
+ def from_json(cls, json_str: str) -> Optional[Self]:
68
+ """Create an instance of InsightResponse from a JSON string"""
69
+ return cls.from_dict(json.loads(json_str))
70
+
71
+ def to_dict(self) -> Dict[str, Any]:
72
+ """Return the dictionary representation of the model using alias.
73
+
74
+ This has the following differences from calling pydantic's
75
+ `self.model_dump(by_alias=True)`:
76
+
77
+ * `None` is only added to the output dict for nullable fields that
78
+ were set at model initialization. Other fields with value `None`
79
+ are ignored.
80
+ """
81
+ excluded_fields: Set[str] = set([
82
+ ])
83
+
84
+ _dict = self.model_dump(
85
+ by_alias=True,
86
+ exclude=excluded_fields,
87
+ exclude_none=True,
88
+ )
89
+ # override the default output from pydantic by calling `to_dict()` of resource
90
+ if self.resource:
91
+ _dict['resource'] = self.resource.to_dict()
92
+ # override the default output from pydantic by calling `to_dict()` of each item in history (list)
93
+ _items = []
94
+ if self.history:
95
+ for _item_history in self.history:
96
+ if _item_history:
97
+ _items.append(_item_history.to_dict())
98
+ _dict['history'] = _items
99
+ # set to None if content (nullable) is None
100
+ # and model_fields_set contains the field
101
+ if self.content is None and "content" in self.model_fields_set:
102
+ _dict['content'] = None
103
+
104
+ return _dict
105
+
106
+ @classmethod
107
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
108
+ """Create an instance of InsightResponse from a dict"""
109
+ if obj is None:
110
+ return None
111
+
112
+ if not isinstance(obj, dict):
113
+ return cls.model_validate(obj)
114
+
115
+ _obj = cls.model_validate({
116
+ "id": obj.get("id"),
117
+ "identity": obj.get("identity"),
118
+ "severity": obj.get("severity"),
119
+ "status": obj.get("status"),
120
+ "title": obj.get("title"),
121
+ "observed_at": obj.get("observed_at"),
122
+ "created_at": obj.get("created_at"),
123
+ "resource": InsightResource.from_dict(obj["resource"]) if obj.get("resource") is not None else None,
124
+ "observed_summary": obj.get("observed_summary"),
125
+ "recommended_steps": obj.get("recommended_steps"),
126
+ "content": obj.get("content"),
127
+ "reported_by": obj.get("reported_by"),
128
+ "updated_at": obj.get("updated_at"),
129
+ "history": [InsightStatusChangeResponse.from_dict(_item) for _item in obj["history"]] if obj.get("history") is not None else None
130
+ })
131
+ return _obj
132
+
133
+
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class InsightSeverity(str, Enum):
22
+ """
23
+ InsightSeverity
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ CRITICAL = 'critical'
30
+ HIGH = 'high'
31
+ MEDIUM = 'medium'
32
+ LOW = 'low'
33
+ INFO = 'info'
34
+
35
+ @classmethod
36
+ def from_json(cls, json_str: str) -> Self:
37
+ """Create an instance of InsightSeverity from a JSON string"""
38
+ return cls(json.loads(json_str))
39
+
40
+
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class InsightStatus(str, Enum):
22
+ """
23
+ InsightStatus
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ NEW = 'new'
30
+ ACKNOWLEDGED = 'acknowledged'
31
+ RESOLVED = 'resolved'
32
+ NOT_RELEVANT = 'not_relevant'
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of InsightStatus from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -17,21 +17,23 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
+ from datetime import datetime
20
21
  from pydantic import BaseModel, ConfigDict, StrictStr
21
- from typing import Any, ClassVar, Dict, List
22
- from platform_api_python_client.models.c_serve_recipe_perf import CServeRecipePerf
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from platform_api_python_client.models.insight_status import InsightStatus
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
 
26
- class CServeRecipeResponse(BaseModel):
27
+ class InsightStatusChangeResponse(BaseModel):
27
28
  """
28
- CServeRecipeResponse
29
+ InsightStatusChangeResponse
29
30
  """ # noqa: E501
30
- model: StrictStr
31
- fastest: CServeRecipePerf
32
- cheapest: CServeRecipePerf
33
- best_value: CServeRecipePerf
34
- __properties: ClassVar[List[str]] = ["model", "fastest", "cheapest", "best_value"]
31
+ from_status: InsightStatus
32
+ to_status: InsightStatus
33
+ actor_name: Optional[StrictStr] = None
34
+ created_at: datetime
35
+ comment: Optional[StrictStr] = None
36
+ __properties: ClassVar[List[str]] = ["from_status", "to_status", "actor_name", "created_at", "comment"]
35
37
 
36
38
  model_config = ConfigDict(
37
39
  populate_by_name=True,
@@ -51,7 +53,7 @@ class CServeRecipeResponse(BaseModel):
51
53
 
52
54
  @classmethod
53
55
  def from_json(cls, json_str: str) -> Optional[Self]:
54
- """Create an instance of CServeRecipeResponse from a JSON string"""
56
+ """Create an instance of InsightStatusChangeResponse from a JSON string"""
55
57
  return cls.from_dict(json.loads(json_str))
56
58
 
57
59
  def to_dict(self) -> Dict[str, Any]:
@@ -72,20 +74,21 @@ class CServeRecipeResponse(BaseModel):
72
74
  exclude=excluded_fields,
73
75
  exclude_none=True,
74
76
  )
75
- # override the default output from pydantic by calling `to_dict()` of fastest
76
- if self.fastest:
77
- _dict['fastest'] = self.fastest.to_dict()
78
- # override the default output from pydantic by calling `to_dict()` of cheapest
79
- if self.cheapest:
80
- _dict['cheapest'] = self.cheapest.to_dict()
81
- # override the default output from pydantic by calling `to_dict()` of best_value
82
- if self.best_value:
83
- _dict['best_value'] = self.best_value.to_dict()
77
+ # set to None if actor_name (nullable) is None
78
+ # and model_fields_set contains the field
79
+ if self.actor_name is None and "actor_name" in self.model_fields_set:
80
+ _dict['actor_name'] = None
81
+
82
+ # set to None if comment (nullable) is None
83
+ # and model_fields_set contains the field
84
+ if self.comment is None and "comment" in self.model_fields_set:
85
+ _dict['comment'] = None
86
+
84
87
  return _dict
85
88
 
86
89
  @classmethod
87
90
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
- """Create an instance of CServeRecipeResponse from a dict"""
91
+ """Create an instance of InsightStatusChangeResponse from a dict"""
89
92
  if obj is None:
90
93
  return None
91
94
 
@@ -93,10 +96,11 @@ class CServeRecipeResponse(BaseModel):
93
96
  return cls.model_validate(obj)
94
97
 
95
98
  _obj = cls.model_validate({
96
- "model": obj.get("model"),
97
- "fastest": CServeRecipePerf.from_dict(obj["fastest"]) if obj.get("fastest") is not None else None,
98
- "cheapest": CServeRecipePerf.from_dict(obj["cheapest"]) if obj.get("cheapest") is not None else None,
99
- "best_value": CServeRecipePerf.from_dict(obj["best_value"]) if obj.get("best_value") is not None else None
99
+ "from_status": obj.get("from_status"),
100
+ "to_status": obj.get("to_status"),
101
+ "actor_name": obj.get("actor_name"),
102
+ "created_at": obj.get("created_at"),
103
+ "comment": obj.get("comment")
100
104
  })
101
105
  return _obj
102
106
 
@@ -17,22 +17,18 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictInt
20
+ from pydantic import BaseModel, ConfigDict, Field
21
21
  from typing import Any, ClassVar, Dict, List
22
- from typing_extensions import Annotated
23
- from platform_api_python_client.models.c_serve_v2_recipe import CServeV2Recipe
22
+ from platform_api_python_client.models.insight_list_item_response import InsightListItemResponse
24
23
  from typing import Optional, Set
25
24
  from typing_extensions import Self
26
25
 
27
- class CServeRecipePerf(BaseModel):
26
+ class ListInsightsResponse(BaseModel):
28
27
  """
29
- CServeRecipePerf
28
+ ListInsightsResponse
30
29
  """ # noqa: E501
31
- recipe: CServeV2Recipe
32
- hardware_instance_id: StrictInt
33
- output_tp: List[Annotated[List[Any], Field(min_length=2, max_length=2)]]
34
- mean_ttft: List[Annotated[List[Any], Field(min_length=2, max_length=2)]]
35
- __properties: ClassVar[List[str]] = ["recipe", "hardware_instance_id", "output_tp", "mean_ttft"]
30
+ results: List[InsightListItemResponse] = Field(description="Newest first. A page shorter than the requested limit is the last one; pass the last id as before_id for the next page.")
31
+ __properties: ClassVar[List[str]] = ["results"]
36
32
 
37
33
  model_config = ConfigDict(
38
34
  populate_by_name=True,
@@ -52,7 +48,7 @@ class CServeRecipePerf(BaseModel):
52
48
 
53
49
  @classmethod
54
50
  def from_json(cls, json_str: str) -> Optional[Self]:
55
- """Create an instance of CServeRecipePerf from a JSON string"""
51
+ """Create an instance of ListInsightsResponse from a JSON string"""
56
52
  return cls.from_dict(json.loads(json_str))
57
53
 
58
54
  def to_dict(self) -> Dict[str, Any]:
@@ -73,14 +69,18 @@ class CServeRecipePerf(BaseModel):
73
69
  exclude=excluded_fields,
74
70
  exclude_none=True,
75
71
  )
76
- # override the default output from pydantic by calling `to_dict()` of recipe
77
- if self.recipe:
78
- _dict['recipe'] = self.recipe.to_dict()
72
+ # override the default output from pydantic by calling `to_dict()` of each item in results (list)
73
+ _items = []
74
+ if self.results:
75
+ for _item_results in self.results:
76
+ if _item_results:
77
+ _items.append(_item_results.to_dict())
78
+ _dict['results'] = _items
79
79
  return _dict
80
80
 
81
81
  @classmethod
82
82
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
- """Create an instance of CServeRecipePerf from a dict"""
83
+ """Create an instance of ListInsightsResponse from a dict"""
84
84
  if obj is None:
85
85
  return None
86
86
 
@@ -88,10 +88,7 @@ class CServeRecipePerf(BaseModel):
88
88
  return cls.model_validate(obj)
89
89
 
90
90
  _obj = cls.model_validate({
91
- "recipe": CServeV2Recipe.from_dict(obj["recipe"]) if obj.get("recipe") is not None else None,
92
- "hardware_instance_id": obj.get("hardware_instance_id"),
93
- "output_tp": obj.get("output_tp"),
94
- "mean_ttft": obj.get("mean_ttft")
91
+ "results": [InsightListItemResponse.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
95
92
  })
96
93
  return _obj
97
94
 
@@ -39,6 +39,19 @@ class Metric(str, Enum):
39
39
  TOKENS_PER_SECOND = 'tokens_per_second'
40
40
  TIME_TO_FIRST_TOKEN = 'time_to_first_token'
41
41
  PREFIX_CACHE_HIT_RATE = 'prefix_cache_hit_rate'
42
+ DYNAMO_TTFT = 'dynamo_ttft'
43
+ DYNAMO_TPOT = 'dynamo_tpot'
44
+ DYNAMO_REQUEST_LATENCY = 'dynamo_request_latency'
45
+ DYNAMO_OUTPUT_THROUGHPUT = 'dynamo_output_throughput'
46
+ DYNAMO_REQUESTS = 'dynamo_requests'
47
+ DYNAMO_QUEUE_DEPTH = 'dynamo_queue_depth'
48
+ DYNAMO_RUNNING_REQUESTS = 'dynamo_running_requests'
49
+ DYNAMO_KV_CACHE = 'dynamo_kv_cache'
50
+ DYNAMO_KV_THROUGHPUT = 'dynamo_kv_throughput'
51
+ DYNAMO_KV_TRANSFER_LATENCY = 'dynamo_kv_transfer_latency'
52
+ DYNAMO_KV_TRANSFERS = 'dynamo_kv_transfers'
53
+ DYNAMO_KV_FAILURES = 'dynamo_kv_failures'
54
+ DYNAMO_TARGETS = 'dynamo_targets'
42
55
 
43
56
  @classmethod
44
57
  def from_json(cls, json_str: str) -> Self:
@@ -0,0 +1,116 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class Pool(BaseModel):
27
+ """
28
+ Pool
29
+ """ # noqa: E501
30
+ hardware_instance_id: StrictInt
31
+ min_replicas: Optional[StrictInt] = None
32
+ max_replicas: Optional[StrictInt] = None
33
+ concurrency: Optional[StrictInt] = None
34
+ cooldown_period: Optional[Annotated[int, Field(le=3600, strict=True, ge=0)]] = None
35
+ __properties: ClassVar[List[str]] = ["hardware_instance_id", "min_replicas", "max_replicas", "concurrency", "cooldown_period"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of Pool from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # set to None if min_replicas (nullable) is None
77
+ # and model_fields_set contains the field
78
+ if self.min_replicas is None and "min_replicas" in self.model_fields_set:
79
+ _dict['min_replicas'] = None
80
+
81
+ # set to None if max_replicas (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.max_replicas is None and "max_replicas" in self.model_fields_set:
84
+ _dict['max_replicas'] = None
85
+
86
+ # set to None if concurrency (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.concurrency is None and "concurrency" in self.model_fields_set:
89
+ _dict['concurrency'] = None
90
+
91
+ # set to None if cooldown_period (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.cooldown_period is None and "cooldown_period" in self.model_fields_set:
94
+ _dict['cooldown_period'] = None
95
+
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
+ """Create an instance of Pool from a dict"""
101
+ if obj is None:
102
+ return None
103
+
104
+ if not isinstance(obj, dict):
105
+ return cls.model_validate(obj)
106
+
107
+ _obj = cls.model_validate({
108
+ "hardware_instance_id": obj.get("hardware_instance_id"),
109
+ "min_replicas": obj.get("min_replicas"),
110
+ "max_replicas": obj.get("max_replicas"),
111
+ "concurrency": obj.get("concurrency"),
112
+ "cooldown_period": obj.get("cooldown_period")
113
+ })
114
+ return _obj
115
+
116
+