platform-api-python-client 4.28.0__py3-none-any.whl → 4.31.0__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.
- platform_api_python_client/__init__.py +5 -1
- platform_api_python_client/api/external_api.py +15 -288
- platform_api_python_client/api_client.py +1 -1
- platform_api_python_client/configuration.py +1 -1
- platform_api_python_client/models/__init__.py +4 -0
- platform_api_python_client/models/cloud_provider.py +5 -0
- platform_api_python_client/models/create_c_serve_v3_deployment_request.py +18 -1
- platform_api_python_client/models/create_compute_deployment_request.py +14 -7
- platform_api_python_client/models/create_dynamo_deployment_request.py +56 -6
- platform_api_python_client/models/create_filesystem_volume_request.py +13 -0
- platform_api_python_client/models/create_inference_v3_deployment_request.py +18 -1
- platform_api_python_client/models/create_job_deployment_request.py +17 -10
- platform_api_python_client/models/create_object_volume_request.py +32 -19
- platform_api_python_client/models/deployment_response.py +21 -6
- platform_api_python_client/models/dynamo_communications_input.py +104 -0
- platform_api_python_client/models/dynamo_communications_output.py +104 -0
- platform_api_python_client/models/dynamo_kv_transfer_configuration.py +101 -0
- platform_api_python_client/models/dynamo_kv_transfer_policy.py +37 -0
- platform_api_python_client/models/dynamo_worker_pool_config.py +38 -5
- platform_api_python_client/models/dynamo_worker_pools.py +24 -4
- platform_api_python_client/models/get_c_serve_v2_deployment_response.py +25 -1
- platform_api_python_client/models/get_c_serve_v3_deployment_response.py +25 -1
- platform_api_python_client/models/get_compute_deployment_response.py +17 -3
- platform_api_python_client/models/get_deployment_response.py +26 -2
- platform_api_python_client/models/get_dynamo_deployment_response.py +47 -5
- platform_api_python_client/models/get_inference_deployment_response.py +25 -1
- platform_api_python_client/models/get_inference_v3_deployment_response.py +25 -1
- platform_api_python_client/models/get_job_deployment_response.py +24 -10
- platform_api_python_client/models/get_object_volume_response.py +2 -16
- platform_api_python_client/models/hardware_instance_response.py +1 -3
- platform_api_python_client/models/validation_error.py +12 -3
- platform_api_python_client/models/volume_mount.py +1 -1
- {platform_api_python_client-4.28.0.dist-info → platform_api_python_client-4.31.0.dist-info}/METADATA +1 -1
- {platform_api_python_client-4.28.0.dist-info → platform_api_python_client-4.31.0.dist-info}/RECORD +36 -32
- {platform_api_python_client-4.28.0.dist-info → platform_api_python_client-4.31.0.dist-info}/WHEEL +0 -0
- {platform_api_python_client-4.28.0.dist-info → platform_api_python_client-4.31.0.dist-info}/top_level.txt +0 -0
|
@@ -21,14 +21,16 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, Strict
|
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from typing_extensions import Annotated
|
|
23
23
|
from platform_api_python_client.models.backend_protocol import BackendProtocol
|
|
24
|
+
from platform_api_python_client.models.dynamo_communications_input import DynamoCommunicationsInput
|
|
24
25
|
from platform_api_python_client.models.dynamo_serving_mode import DynamoServingMode
|
|
25
26
|
from platform_api_python_client.models.dynamo_worker_pools import DynamoWorkerPools
|
|
27
|
+
from platform_api_python_client.models.volume_mount import VolumeMount
|
|
26
28
|
from typing import Optional, Set
|
|
27
29
|
from typing_extensions import Self
|
|
28
30
|
|
|
29
31
|
class CreateDynamoDeploymentRequest(BaseModel):
|
|
30
32
|
"""
|
|
31
|
-
Create a Dynamo deployment.
|
|
33
|
+
Create a Dynamo deployment. Hardware and scaling live under ``worker_pools``: aggregated mode uses exactly ``worker_pools.worker``; disaggregated mode uses exactly ``worker_pools.prefill`` and ``worker_pools.decode`` (fixed-size until per-role autoscaling ships). The top-level ``hardware_instance_id`` / ``min_replicas`` / ``max_replicas`` / ``concurrency`` / ``cooldown_period`` fields are the deprecated aggregated-only spelling; they stay accepted and may accompany ``worker_pools`` when they agree with it. ``parse_dynamo_topology`` owns every topology rule for both spellings.
|
|
32
34
|
""" # noqa: E501
|
|
33
35
|
max_surge: Optional[StrictInt] = None
|
|
34
36
|
max_unavailable: Optional[StrictInt] = None
|
|
@@ -37,12 +39,16 @@ class CreateDynamoDeploymentRequest(BaseModel):
|
|
|
37
39
|
hardware_instance_id: Optional[StrictInt] = None
|
|
38
40
|
user_annotations: Optional[Dict[str, StrictStr]] = None
|
|
39
41
|
chart_revision: Optional[StrictStr] = None
|
|
42
|
+
volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
|
|
43
|
+
priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
|
|
40
44
|
serving_mode: Optional[DynamoServingMode] = None
|
|
41
45
|
worker_pools: Optional[DynamoWorkerPools] = None
|
|
46
|
+
communications: Optional[DynamoCommunicationsInput] = None
|
|
42
47
|
model: StrictStr
|
|
43
48
|
served_model_name: Optional[StrictStr] = None
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
runtime_version: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Dynamo runtime image tag (for example 1.4.0). Defaults to the platform's current release; GET /prebuilt-images?type=dynamo lists the versions the platform has validated, but any tag may be requested. require_gpu_direct_rdma needs an EFA-capable image. Changing it restarts every component of a running deployment.")
|
|
50
|
+
min_replicas: Optional[StrictInt] = None
|
|
51
|
+
max_replicas: Optional[StrictInt] = None
|
|
46
52
|
concurrency: Optional[StrictInt] = None
|
|
47
53
|
cooldown_period: Optional[StrictInt] = None
|
|
48
54
|
extra_args: Optional[StrictStr] = None
|
|
@@ -53,7 +59,7 @@ class CreateDynamoDeploymentRequest(BaseModel):
|
|
|
53
59
|
enable_logging: Optional[StrictBool] = True
|
|
54
60
|
enable_node_model_cache: Optional[StrictBool] = False
|
|
55
61
|
backend_protocol: Optional[BackendProtocol] = None
|
|
56
|
-
__properties: ClassVar[List[str]] = ["max_surge", "max_unavailable", "name", "cluster_id", "hardware_instance_id", "user_annotations", "chart_revision", "serving_mode", "worker_pools", "model", "served_model_name", "min_replicas", "max_replicas", "concurrency", "cooldown_period", "extra_args", "hf_token", "env_vars", "endpoint_bearer_token", "endpoint_certificate_authority", "enable_logging", "enable_node_model_cache", "backend_protocol"]
|
|
62
|
+
__properties: ClassVar[List[str]] = ["max_surge", "max_unavailable", "name", "cluster_id", "hardware_instance_id", "user_annotations", "chart_revision", "volume_mounts", "priority", "serving_mode", "worker_pools", "communications", "model", "served_model_name", "runtime_version", "min_replicas", "max_replicas", "concurrency", "cooldown_period", "extra_args", "hf_token", "env_vars", "endpoint_bearer_token", "endpoint_certificate_authority", "enable_logging", "enable_node_model_cache", "backend_protocol"]
|
|
57
63
|
|
|
58
64
|
@field_validator('name')
|
|
59
65
|
def name_validate_regular_expression(cls, value):
|
|
@@ -62,6 +68,16 @@ class CreateDynamoDeploymentRequest(BaseModel):
|
|
|
62
68
|
raise ValueError(r"must validate the regular expression /^[a-z][a-z0-9-]*$/")
|
|
63
69
|
return value
|
|
64
70
|
|
|
71
|
+
@field_validator('runtime_version')
|
|
72
|
+
def runtime_version_validate_regular_expression(cls, value):
|
|
73
|
+
"""Validates the regular expression"""
|
|
74
|
+
if value is None:
|
|
75
|
+
return value
|
|
76
|
+
|
|
77
|
+
if not re.match(r"^[A-Za-z0-9_][A-Za-z0-9._-]{0,127}$", value):
|
|
78
|
+
raise ValueError(r"must validate the regular expression /^[A-Za-z0-9_][A-Za-z0-9._-]{0,127}$/")
|
|
79
|
+
return value
|
|
80
|
+
|
|
65
81
|
model_config = ConfigDict(
|
|
66
82
|
populate_by_name=True,
|
|
67
83
|
validate_assignment=True,
|
|
@@ -101,9 +117,19 @@ class CreateDynamoDeploymentRequest(BaseModel):
|
|
|
101
117
|
exclude=excluded_fields,
|
|
102
118
|
exclude_none=True,
|
|
103
119
|
)
|
|
120
|
+
# override the default output from pydantic by calling `to_dict()` of each item in volume_mounts (list)
|
|
121
|
+
_items = []
|
|
122
|
+
if self.volume_mounts:
|
|
123
|
+
for _item_volume_mounts in self.volume_mounts:
|
|
124
|
+
if _item_volume_mounts:
|
|
125
|
+
_items.append(_item_volume_mounts.to_dict())
|
|
126
|
+
_dict['volume_mounts'] = _items
|
|
104
127
|
# override the default output from pydantic by calling `to_dict()` of worker_pools
|
|
105
128
|
if self.worker_pools:
|
|
106
129
|
_dict['worker_pools'] = self.worker_pools.to_dict()
|
|
130
|
+
# override the default output from pydantic by calling `to_dict()` of communications
|
|
131
|
+
if self.communications:
|
|
132
|
+
_dict['communications'] = self.communications.to_dict()
|
|
107
133
|
# set to None if max_surge (nullable) is None
|
|
108
134
|
# and model_fields_set contains the field
|
|
109
135
|
if self.max_surge is None and "max_surge" in self.model_fields_set:
|
|
@@ -124,16 +150,36 @@ class CreateDynamoDeploymentRequest(BaseModel):
|
|
|
124
150
|
if self.user_annotations is None and "user_annotations" in self.model_fields_set:
|
|
125
151
|
_dict['user_annotations'] = None
|
|
126
152
|
|
|
153
|
+
# set to None if priority (nullable) is None
|
|
154
|
+
# and model_fields_set contains the field
|
|
155
|
+
if self.priority is None and "priority" in self.model_fields_set:
|
|
156
|
+
_dict['priority'] = None
|
|
157
|
+
|
|
127
158
|
# set to None if worker_pools (nullable) is None
|
|
128
159
|
# and model_fields_set contains the field
|
|
129
160
|
if self.worker_pools is None and "worker_pools" in self.model_fields_set:
|
|
130
161
|
_dict['worker_pools'] = None
|
|
131
162
|
|
|
163
|
+
# set to None if communications (nullable) is None
|
|
164
|
+
# and model_fields_set contains the field
|
|
165
|
+
if self.communications is None and "communications" in self.model_fields_set:
|
|
166
|
+
_dict['communications'] = None
|
|
167
|
+
|
|
132
168
|
# set to None if served_model_name (nullable) is None
|
|
133
169
|
# and model_fields_set contains the field
|
|
134
170
|
if self.served_model_name is None and "served_model_name" in self.model_fields_set:
|
|
135
171
|
_dict['served_model_name'] = None
|
|
136
172
|
|
|
173
|
+
# set to None if min_replicas (nullable) is None
|
|
174
|
+
# and model_fields_set contains the field
|
|
175
|
+
if self.min_replicas is None and "min_replicas" in self.model_fields_set:
|
|
176
|
+
_dict['min_replicas'] = None
|
|
177
|
+
|
|
178
|
+
# set to None if max_replicas (nullable) is None
|
|
179
|
+
# and model_fields_set contains the field
|
|
180
|
+
if self.max_replicas is None and "max_replicas" in self.model_fields_set:
|
|
181
|
+
_dict['max_replicas'] = None
|
|
182
|
+
|
|
137
183
|
# set to None if concurrency (nullable) is None
|
|
138
184
|
# and model_fields_set contains the field
|
|
139
185
|
if self.concurrency is None and "concurrency" in self.model_fields_set:
|
|
@@ -183,12 +229,16 @@ class CreateDynamoDeploymentRequest(BaseModel):
|
|
|
183
229
|
"hardware_instance_id": obj.get("hardware_instance_id"),
|
|
184
230
|
"user_annotations": obj.get("user_annotations"),
|
|
185
231
|
"chart_revision": obj.get("chart_revision"),
|
|
232
|
+
"volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
|
|
233
|
+
"priority": obj.get("priority"),
|
|
186
234
|
"serving_mode": obj.get("serving_mode"),
|
|
187
235
|
"worker_pools": DynamoWorkerPools.from_dict(obj["worker_pools"]) if obj.get("worker_pools") is not None else None,
|
|
236
|
+
"communications": DynamoCommunicationsInput.from_dict(obj["communications"]) if obj.get("communications") is not None else None,
|
|
188
237
|
"model": obj.get("model"),
|
|
189
238
|
"served_model_name": obj.get("served_model_name"),
|
|
190
|
-
"
|
|
191
|
-
"
|
|
239
|
+
"runtime_version": obj.get("runtime_version"),
|
|
240
|
+
"min_replicas": obj.get("min_replicas"),
|
|
241
|
+
"max_replicas": obj.get("max_replicas"),
|
|
192
242
|
"concurrency": obj.get("concurrency"),
|
|
193
243
|
"cooldown_period": obj.get("cooldown_period"),
|
|
194
244
|
"extra_args": obj.get("extra_args"),
|
|
@@ -32,6 +32,7 @@ class CreateFilesystemVolumeRequest(BaseModel):
|
|
|
32
32
|
backend: StrictStr
|
|
33
33
|
size_gb: Optional[Annotated[int, Field(le=65536, strict=True, ge=1)]] = 100
|
|
34
34
|
storage_class: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=253)]] = None
|
|
35
|
+
additional_properties: Dict[str, Any] = {}
|
|
35
36
|
__properties: ClassVar[List[str]] = ["name", "cluster_id", "backend", "size_gb", "storage_class"]
|
|
36
37
|
|
|
37
38
|
@field_validator('name')
|
|
@@ -88,8 +89,10 @@ class CreateFilesystemVolumeRequest(BaseModel):
|
|
|
88
89
|
* `None` is only added to the output dict for nullable fields that
|
|
89
90
|
were set at model initialization. Other fields with value `None`
|
|
90
91
|
are ignored.
|
|
92
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
91
93
|
"""
|
|
92
94
|
excluded_fields: Set[str] = set([
|
|
95
|
+
"additional_properties",
|
|
93
96
|
])
|
|
94
97
|
|
|
95
98
|
_dict = self.model_dump(
|
|
@@ -97,6 +100,11 @@ class CreateFilesystemVolumeRequest(BaseModel):
|
|
|
97
100
|
exclude=excluded_fields,
|
|
98
101
|
exclude_none=True,
|
|
99
102
|
)
|
|
103
|
+
# puts key-value pairs in additional_properties in the top level
|
|
104
|
+
if self.additional_properties is not None:
|
|
105
|
+
for _key, _value in self.additional_properties.items():
|
|
106
|
+
_dict[_key] = _value
|
|
107
|
+
|
|
100
108
|
# set to None if storage_class (nullable) is None
|
|
101
109
|
# and model_fields_set contains the field
|
|
102
110
|
if self.storage_class is None and "storage_class" in self.model_fields_set:
|
|
@@ -120,6 +128,11 @@ class CreateFilesystemVolumeRequest(BaseModel):
|
|
|
120
128
|
"size_gb": obj.get("size_gb") if obj.get("size_gb") is not None else 100,
|
|
121
129
|
"storage_class": obj.get("storage_class")
|
|
122
130
|
})
|
|
131
|
+
# store additional fields in additional_properties
|
|
132
|
+
for _key in obj.keys():
|
|
133
|
+
if _key not in cls.__properties:
|
|
134
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
135
|
+
|
|
123
136
|
return _obj
|
|
124
137
|
|
|
125
138
|
|
|
@@ -24,6 +24,7 @@ from platform_api_python_client.models.backend_protocol import BackendProtocol
|
|
|
24
24
|
from platform_api_python_client.models.config_file_mount import ConfigFileMount
|
|
25
25
|
from platform_api_python_client.models.image_pull_secret_credentials import ImagePullSecretCredentials
|
|
26
26
|
from platform_api_python_client.models.metrics_config import MetricsConfig
|
|
27
|
+
from platform_api_python_client.models.volume_mount import VolumeMount
|
|
27
28
|
from typing import Optional, Set
|
|
28
29
|
from typing_extensions import Self
|
|
29
30
|
|
|
@@ -38,6 +39,8 @@ class CreateInferenceV3DeploymentRequest(BaseModel):
|
|
|
38
39
|
hardware_instance_id: StrictInt
|
|
39
40
|
user_annotations: Optional[Dict[str, StrictStr]] = None
|
|
40
41
|
chart_revision: Optional[StrictStr] = None
|
|
42
|
+
volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
|
|
43
|
+
priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
|
|
41
44
|
image_url: StrictStr
|
|
42
45
|
image_pull_secret_credentials: Optional[ImagePullSecretCredentials] = None
|
|
43
46
|
port: Annotated[int, Field(le=65535, strict=True, ge=1)]
|
|
@@ -57,7 +60,7 @@ class CreateInferenceV3DeploymentRequest(BaseModel):
|
|
|
57
60
|
session_affinity: Optional[StrictBool] = Field(default=False, description="Enable best-effort sticky routing via the `X-Session-Id` request header. Requests carrying the same header value land on the same pod, improving KV cache reuse for agentic workloads. Requests without the header are routed at random. Affinity is NOT durable: scaling, rollouts, restarts, or readiness-probe transitions will remap sessions to different pods. Do not use for irreplaceable in-pod state.")
|
|
58
61
|
config_file: Optional[ConfigFileMount] = None
|
|
59
62
|
metrics: Optional[MetricsConfig] = None
|
|
60
|
-
__properties: ClassVar[List[str]] = ["max_surge", "max_unavailable", "name", "cluster_id", "hardware_instance_id", "user_annotations", "chart_revision", "image_url", "image_pull_secret_credentials", "port", "min_replicas", "max_replicas", "concurrency", "cooldown_period", "healthcheck", "env_vars", "command", "endpoint_bearer_token", "endpoint_certificate_authority", "hf_token", "backend_protocol", "enable_logging", "enable_node_model_cache", "session_affinity", "config_file", "metrics"]
|
|
63
|
+
__properties: ClassVar[List[str]] = ["max_surge", "max_unavailable", "name", "cluster_id", "hardware_instance_id", "user_annotations", "chart_revision", "volume_mounts", "priority", "image_url", "image_pull_secret_credentials", "port", "min_replicas", "max_replicas", "concurrency", "cooldown_period", "healthcheck", "env_vars", "command", "endpoint_bearer_token", "endpoint_certificate_authority", "hf_token", "backend_protocol", "enable_logging", "enable_node_model_cache", "session_affinity", "config_file", "metrics"]
|
|
61
64
|
|
|
62
65
|
@field_validator('name')
|
|
63
66
|
def name_validate_regular_expression(cls, value):
|
|
@@ -105,6 +108,13 @@ class CreateInferenceV3DeploymentRequest(BaseModel):
|
|
|
105
108
|
exclude=excluded_fields,
|
|
106
109
|
exclude_none=True,
|
|
107
110
|
)
|
|
111
|
+
# override the default output from pydantic by calling `to_dict()` of each item in volume_mounts (list)
|
|
112
|
+
_items = []
|
|
113
|
+
if self.volume_mounts:
|
|
114
|
+
for _item_volume_mounts in self.volume_mounts:
|
|
115
|
+
if _item_volume_mounts:
|
|
116
|
+
_items.append(_item_volume_mounts.to_dict())
|
|
117
|
+
_dict['volume_mounts'] = _items
|
|
108
118
|
# override the default output from pydantic by calling `to_dict()` of image_pull_secret_credentials
|
|
109
119
|
if self.image_pull_secret_credentials:
|
|
110
120
|
_dict['image_pull_secret_credentials'] = self.image_pull_secret_credentials.to_dict()
|
|
@@ -129,6 +139,11 @@ class CreateInferenceV3DeploymentRequest(BaseModel):
|
|
|
129
139
|
if self.user_annotations is None and "user_annotations" in self.model_fields_set:
|
|
130
140
|
_dict['user_annotations'] = None
|
|
131
141
|
|
|
142
|
+
# set to None if priority (nullable) is None
|
|
143
|
+
# and model_fields_set contains the field
|
|
144
|
+
if self.priority is None and "priority" in self.model_fields_set:
|
|
145
|
+
_dict['priority'] = None
|
|
146
|
+
|
|
132
147
|
# set to None if image_pull_secret_credentials (nullable) is None
|
|
133
148
|
# and model_fields_set contains the field
|
|
134
149
|
if self.image_pull_secret_credentials is None and "image_pull_secret_credentials" in self.model_fields_set:
|
|
@@ -203,6 +218,8 @@ class CreateInferenceV3DeploymentRequest(BaseModel):
|
|
|
203
218
|
"hardware_instance_id": obj.get("hardware_instance_id"),
|
|
204
219
|
"user_annotations": obj.get("user_annotations"),
|
|
205
220
|
"chart_revision": obj.get("chart_revision"),
|
|
221
|
+
"volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
|
|
222
|
+
"priority": obj.get("priority"),
|
|
206
223
|
"image_url": obj.get("image_url"),
|
|
207
224
|
"image_pull_secret_credentials": ImagePullSecretCredentials.from_dict(obj["image_pull_secret_credentials"]) if obj.get("image_pull_secret_credentials") is not None else None,
|
|
208
225
|
"port": obj.get("port"),
|
|
@@ -35,6 +35,8 @@ class CreateJobDeploymentRequest(BaseModel):
|
|
|
35
35
|
hardware_instance_id: StrictInt
|
|
36
36
|
user_annotations: Optional[Dict[str, StrictStr]] = None
|
|
37
37
|
chart_revision: Optional[StrictStr] = None
|
|
38
|
+
volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
|
|
39
|
+
priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
|
|
38
40
|
image_url: StrictStr
|
|
39
41
|
image_pull_secret_credentials: Optional[ImagePullSecretCredentials] = None
|
|
40
42
|
env_vars: Optional[Dict[str, StrictStr]] = None
|
|
@@ -45,8 +47,7 @@ class CreateJobDeploymentRequest(BaseModel):
|
|
|
45
47
|
active_deadline_seconds: Optional[StrictInt] = None
|
|
46
48
|
enable_logging: Optional[StrictBool] = True
|
|
47
49
|
config_file: Optional[ConfigFileMount] = None
|
|
48
|
-
|
|
49
|
-
__properties: ClassVar[List[str]] = ["name", "cluster_id", "hardware_instance_id", "user_annotations", "chart_revision", "image_url", "image_pull_secret_credentials", "env_vars", "command", "completions", "parallelism", "backoff_limit", "active_deadline_seconds", "enable_logging", "config_file", "volume_mounts"]
|
|
50
|
+
__properties: ClassVar[List[str]] = ["name", "cluster_id", "hardware_instance_id", "user_annotations", "chart_revision", "volume_mounts", "priority", "image_url", "image_pull_secret_credentials", "env_vars", "command", "completions", "parallelism", "backoff_limit", "active_deadline_seconds", "enable_logging", "config_file"]
|
|
50
51
|
|
|
51
52
|
@field_validator('name')
|
|
52
53
|
def name_validate_regular_expression(cls, value):
|
|
@@ -94,12 +95,6 @@ class CreateJobDeploymentRequest(BaseModel):
|
|
|
94
95
|
exclude=excluded_fields,
|
|
95
96
|
exclude_none=True,
|
|
96
97
|
)
|
|
97
|
-
# override the default output from pydantic by calling `to_dict()` of image_pull_secret_credentials
|
|
98
|
-
if self.image_pull_secret_credentials:
|
|
99
|
-
_dict['image_pull_secret_credentials'] = self.image_pull_secret_credentials.to_dict()
|
|
100
|
-
# override the default output from pydantic by calling `to_dict()` of config_file
|
|
101
|
-
if self.config_file:
|
|
102
|
-
_dict['config_file'] = self.config_file.to_dict()
|
|
103
98
|
# override the default output from pydantic by calling `to_dict()` of each item in volume_mounts (list)
|
|
104
99
|
_items = []
|
|
105
100
|
if self.volume_mounts:
|
|
@@ -107,11 +102,22 @@ class CreateJobDeploymentRequest(BaseModel):
|
|
|
107
102
|
if _item_volume_mounts:
|
|
108
103
|
_items.append(_item_volume_mounts.to_dict())
|
|
109
104
|
_dict['volume_mounts'] = _items
|
|
105
|
+
# override the default output from pydantic by calling `to_dict()` of image_pull_secret_credentials
|
|
106
|
+
if self.image_pull_secret_credentials:
|
|
107
|
+
_dict['image_pull_secret_credentials'] = self.image_pull_secret_credentials.to_dict()
|
|
108
|
+
# override the default output from pydantic by calling `to_dict()` of config_file
|
|
109
|
+
if self.config_file:
|
|
110
|
+
_dict['config_file'] = self.config_file.to_dict()
|
|
110
111
|
# set to None if user_annotations (nullable) is None
|
|
111
112
|
# and model_fields_set contains the field
|
|
112
113
|
if self.user_annotations is None and "user_annotations" in self.model_fields_set:
|
|
113
114
|
_dict['user_annotations'] = None
|
|
114
115
|
|
|
116
|
+
# set to None if priority (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.priority is None and "priority" in self.model_fields_set:
|
|
119
|
+
_dict['priority'] = None
|
|
120
|
+
|
|
115
121
|
# set to None if image_pull_secret_credentials (nullable) is None
|
|
116
122
|
# and model_fields_set contains the field
|
|
117
123
|
if self.image_pull_secret_credentials is None and "image_pull_secret_credentials" in self.model_fields_set:
|
|
@@ -154,6 +160,8 @@ class CreateJobDeploymentRequest(BaseModel):
|
|
|
154
160
|
"hardware_instance_id": obj.get("hardware_instance_id"),
|
|
155
161
|
"user_annotations": obj.get("user_annotations"),
|
|
156
162
|
"chart_revision": obj.get("chart_revision"),
|
|
163
|
+
"volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
|
|
164
|
+
"priority": obj.get("priority"),
|
|
157
165
|
"image_url": obj.get("image_url"),
|
|
158
166
|
"image_pull_secret_credentials": ImagePullSecretCredentials.from_dict(obj["image_pull_secret_credentials"]) if obj.get("image_pull_secret_credentials") is not None else None,
|
|
159
167
|
"env_vars": obj.get("env_vars"),
|
|
@@ -163,8 +171,7 @@ class CreateJobDeploymentRequest(BaseModel):
|
|
|
163
171
|
"backoff_limit": obj.get("backoff_limit") if obj.get("backoff_limit") is not None else 3,
|
|
164
172
|
"active_deadline_seconds": obj.get("active_deadline_seconds"),
|
|
165
173
|
"enable_logging": obj.get("enable_logging") if obj.get("enable_logging") is not None else True,
|
|
166
|
-
"config_file": ConfigFileMount.from_dict(obj["config_file"]) if obj.get("config_file") is not None else None
|
|
167
|
-
"volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None
|
|
174
|
+
"config_file": ConfigFileMount.from_dict(obj["config_file"]) if obj.get("config_file") is not None else None
|
|
168
175
|
})
|
|
169
176
|
return _obj
|
|
170
177
|
|
|
@@ -32,13 +32,12 @@ class CreateObjectVolumeRequest(BaseModel):
|
|
|
32
32
|
cluster_id: StrictInt
|
|
33
33
|
backend: StrictStr
|
|
34
34
|
provider: Optional[ObjectStorageProvider] = None
|
|
35
|
-
bucket: Annotated[str, Field(min_length=3, strict=True, max_length=
|
|
36
|
-
region: Annotated[str, Field(min_length=1, strict=True)]
|
|
37
|
-
prefix: Optional[
|
|
35
|
+
bucket: Annotated[str, Field(min_length=3, strict=True, max_length=255)]
|
|
36
|
+
region: Annotated[str, Field(min_length=1, strict=True, max_length=63)]
|
|
37
|
+
prefix: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = None
|
|
38
38
|
read_only: Optional[StrictBool] = False
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
__properties: ClassVar[List[str]] = ["name", "cluster_id", "backend", "provider", "bucket", "region", "prefix", "read_only", "volume_attributes", "mount_options"]
|
|
39
|
+
additional_properties: Dict[str, Any] = {}
|
|
40
|
+
__properties: ClassVar[List[str]] = ["name", "cluster_id", "backend", "provider", "bucket", "region", "prefix", "read_only"]
|
|
42
41
|
|
|
43
42
|
@field_validator('name')
|
|
44
43
|
def name_validate_regular_expression(cls, value):
|
|
@@ -54,6 +53,20 @@ class CreateObjectVolumeRequest(BaseModel):
|
|
|
54
53
|
raise ValueError("must be one of enum values ('object')")
|
|
55
54
|
return value
|
|
56
55
|
|
|
56
|
+
@field_validator('bucket')
|
|
57
|
+
def bucket_validate_regular_expression(cls, value):
|
|
58
|
+
"""Validates the regular expression"""
|
|
59
|
+
if not re.match(r"^(?:[0-9A-Za-z._-]+|arn:[a-z0-9-]+:s3(?:-outposts|-object-lambda)?:[0-9A-Za-z._:\/+=,@-]+)$", value):
|
|
60
|
+
raise ValueError(r"must validate the regular expression /^(?:[0-9A-Za-z._-]+|arn:[a-z0-9-]+:s3(?:-outposts|-object-lambda)?:[0-9A-Za-z._:\/+=,@-]+)$/")
|
|
61
|
+
return value
|
|
62
|
+
|
|
63
|
+
@field_validator('region')
|
|
64
|
+
def region_validate_regular_expression(cls, value):
|
|
65
|
+
"""Validates the regular expression"""
|
|
66
|
+
if not re.match(r"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$", value):
|
|
67
|
+
raise ValueError(r"must validate the regular expression /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/")
|
|
68
|
+
return value
|
|
69
|
+
|
|
57
70
|
model_config = ConfigDict(
|
|
58
71
|
populate_by_name=True,
|
|
59
72
|
validate_assignment=True,
|
|
@@ -84,8 +97,10 @@ class CreateObjectVolumeRequest(BaseModel):
|
|
|
84
97
|
* `None` is only added to the output dict for nullable fields that
|
|
85
98
|
were set at model initialization. Other fields with value `None`
|
|
86
99
|
are ignored.
|
|
100
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
87
101
|
"""
|
|
88
102
|
excluded_fields: Set[str] = set([
|
|
103
|
+
"additional_properties",
|
|
89
104
|
])
|
|
90
105
|
|
|
91
106
|
_dict = self.model_dump(
|
|
@@ -93,21 +108,16 @@ class CreateObjectVolumeRequest(BaseModel):
|
|
|
93
108
|
exclude=excluded_fields,
|
|
94
109
|
exclude_none=True,
|
|
95
110
|
)
|
|
111
|
+
# puts key-value pairs in additional_properties in the top level
|
|
112
|
+
if self.additional_properties is not None:
|
|
113
|
+
for _key, _value in self.additional_properties.items():
|
|
114
|
+
_dict[_key] = _value
|
|
115
|
+
|
|
96
116
|
# set to None if prefix (nullable) is None
|
|
97
117
|
# and model_fields_set contains the field
|
|
98
118
|
if self.prefix is None and "prefix" in self.model_fields_set:
|
|
99
119
|
_dict['prefix'] = None
|
|
100
120
|
|
|
101
|
-
# set to None if volume_attributes (nullable) is None
|
|
102
|
-
# and model_fields_set contains the field
|
|
103
|
-
if self.volume_attributes is None and "volume_attributes" in self.model_fields_set:
|
|
104
|
-
_dict['volume_attributes'] = None
|
|
105
|
-
|
|
106
|
-
# set to None if mount_options (nullable) is None
|
|
107
|
-
# and model_fields_set contains the field
|
|
108
|
-
if self.mount_options is None and "mount_options" in self.model_fields_set:
|
|
109
|
-
_dict['mount_options'] = None
|
|
110
|
-
|
|
111
121
|
return _dict
|
|
112
122
|
|
|
113
123
|
@classmethod
|
|
@@ -127,10 +137,13 @@ class CreateObjectVolumeRequest(BaseModel):
|
|
|
127
137
|
"bucket": obj.get("bucket"),
|
|
128
138
|
"region": obj.get("region"),
|
|
129
139
|
"prefix": obj.get("prefix"),
|
|
130
|
-
"read_only": obj.get("read_only") if obj.get("read_only") is not None else False
|
|
131
|
-
"volume_attributes": obj.get("volume_attributes"),
|
|
132
|
-
"mount_options": obj.get("mount_options")
|
|
140
|
+
"read_only": obj.get("read_only") if obj.get("read_only") is not None else False
|
|
133
141
|
})
|
|
142
|
+
# store additional fields in additional_properties
|
|
143
|
+
for _key in obj.keys():
|
|
144
|
+
if _key not in cls.__properties:
|
|
145
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
146
|
+
|
|
134
147
|
return _obj
|
|
135
148
|
|
|
136
149
|
|
|
@@ -23,11 +23,12 @@ from platform_api_python_client.models.get_c_serve_v3_deployment_response import
|
|
|
23
23
|
from platform_api_python_client.models.get_compute_deployment_response import GetComputeDeploymentResponse
|
|
24
24
|
from platform_api_python_client.models.get_dynamo_deployment_response import GetDynamoDeploymentResponse
|
|
25
25
|
from platform_api_python_client.models.get_inference_v3_deployment_response import GetInferenceV3DeploymentResponse
|
|
26
|
+
from platform_api_python_client.models.get_job_deployment_response import GetJobDeploymentResponse
|
|
26
27
|
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
27
28
|
from typing_extensions import Literal, Self
|
|
28
29
|
from pydantic import Field
|
|
29
30
|
|
|
30
|
-
DEPLOYMENTRESPONSE_ANY_OF_SCHEMAS = ["GetCServeV3DeploymentResponse", "GetComputeDeploymentResponse", "GetDynamoDeploymentResponse", "GetInferenceV3DeploymentResponse"]
|
|
31
|
+
DEPLOYMENTRESPONSE_ANY_OF_SCHEMAS = ["GetCServeV3DeploymentResponse", "GetComputeDeploymentResponse", "GetDynamoDeploymentResponse", "GetInferenceV3DeploymentResponse", "GetJobDeploymentResponse"]
|
|
31
32
|
|
|
32
33
|
class DeploymentResponse(BaseModel):
|
|
33
34
|
"""
|
|
@@ -42,11 +43,13 @@ class DeploymentResponse(BaseModel):
|
|
|
42
43
|
anyof_schema_3_validator: Optional[GetInferenceV3DeploymentResponse] = None
|
|
43
44
|
# data type: GetComputeDeploymentResponse
|
|
44
45
|
anyof_schema_4_validator: Optional[GetComputeDeploymentResponse] = None
|
|
46
|
+
# data type: GetJobDeploymentResponse
|
|
47
|
+
anyof_schema_5_validator: Optional[GetJobDeploymentResponse] = None
|
|
45
48
|
if TYPE_CHECKING:
|
|
46
|
-
actual_instance: Optional[Union[GetCServeV3DeploymentResponse, GetComputeDeploymentResponse, GetDynamoDeploymentResponse, GetInferenceV3DeploymentResponse]] = None
|
|
49
|
+
actual_instance: Optional[Union[GetCServeV3DeploymentResponse, GetComputeDeploymentResponse, GetDynamoDeploymentResponse, GetInferenceV3DeploymentResponse, GetJobDeploymentResponse]] = None
|
|
47
50
|
else:
|
|
48
51
|
actual_instance: Any = None
|
|
49
|
-
any_of_schemas: Set[str] = { "GetCServeV3DeploymentResponse", "GetComputeDeploymentResponse", "GetDynamoDeploymentResponse", "GetInferenceV3DeploymentResponse" }
|
|
52
|
+
any_of_schemas: Set[str] = { "GetCServeV3DeploymentResponse", "GetComputeDeploymentResponse", "GetDynamoDeploymentResponse", "GetInferenceV3DeploymentResponse", "GetJobDeploymentResponse" }
|
|
50
53
|
|
|
51
54
|
model_config = {
|
|
52
55
|
"validate_assignment": True,
|
|
@@ -91,9 +94,15 @@ class DeploymentResponse(BaseModel):
|
|
|
91
94
|
else:
|
|
92
95
|
return v
|
|
93
96
|
|
|
97
|
+
# validate data type: GetJobDeploymentResponse
|
|
98
|
+
if not isinstance(v, GetJobDeploymentResponse):
|
|
99
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `GetJobDeploymentResponse`")
|
|
100
|
+
else:
|
|
101
|
+
return v
|
|
102
|
+
|
|
94
103
|
if error_messages:
|
|
95
104
|
# no match
|
|
96
|
-
raise ValueError("No match found when setting the actual_instance in DeploymentResponse with anyOf schemas: GetCServeV3DeploymentResponse, GetComputeDeploymentResponse, GetDynamoDeploymentResponse, GetInferenceV3DeploymentResponse. Details: " + ", ".join(error_messages))
|
|
105
|
+
raise ValueError("No match found when setting the actual_instance in DeploymentResponse with anyOf schemas: GetCServeV3DeploymentResponse, GetComputeDeploymentResponse, GetDynamoDeploymentResponse, GetInferenceV3DeploymentResponse, GetJobDeploymentResponse. Details: " + ", ".join(error_messages))
|
|
97
106
|
else:
|
|
98
107
|
return v
|
|
99
108
|
|
|
@@ -130,10 +139,16 @@ class DeploymentResponse(BaseModel):
|
|
|
130
139
|
return instance
|
|
131
140
|
except (ValidationError, ValueError) as e:
|
|
132
141
|
error_messages.append(str(e))
|
|
142
|
+
# anyof_schema_5_validator: Optional[GetJobDeploymentResponse] = None
|
|
143
|
+
try:
|
|
144
|
+
instance.actual_instance = GetJobDeploymentResponse.from_json(json_str)
|
|
145
|
+
return instance
|
|
146
|
+
except (ValidationError, ValueError) as e:
|
|
147
|
+
error_messages.append(str(e))
|
|
133
148
|
|
|
134
149
|
if error_messages:
|
|
135
150
|
# no match
|
|
136
|
-
raise ValueError("No match found when deserializing the JSON string into DeploymentResponse with anyOf schemas: GetCServeV3DeploymentResponse, GetComputeDeploymentResponse, GetDynamoDeploymentResponse, GetInferenceV3DeploymentResponse. Details: " + ", ".join(error_messages))
|
|
151
|
+
raise ValueError("No match found when deserializing the JSON string into DeploymentResponse with anyOf schemas: GetCServeV3DeploymentResponse, GetComputeDeploymentResponse, GetDynamoDeploymentResponse, GetInferenceV3DeploymentResponse, GetJobDeploymentResponse. Details: " + ", ".join(error_messages))
|
|
137
152
|
else:
|
|
138
153
|
return instance
|
|
139
154
|
|
|
@@ -147,7 +162,7 @@ class DeploymentResponse(BaseModel):
|
|
|
147
162
|
else:
|
|
148
163
|
return json.dumps(self.actual_instance)
|
|
149
164
|
|
|
150
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], GetCServeV3DeploymentResponse, GetComputeDeploymentResponse, GetDynamoDeploymentResponse, GetInferenceV3DeploymentResponse]]:
|
|
165
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], GetCServeV3DeploymentResponse, GetComputeDeploymentResponse, GetDynamoDeploymentResponse, GetInferenceV3DeploymentResponse, GetJobDeploymentResponse]]:
|
|
151
166
|
"""Returns the dict representation of the actual instance"""
|
|
152
167
|
if self.actual_instance is None:
|
|
153
168
|
return None
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from platform_api_python_client.models.dynamo_kv_transfer_configuration import DynamoKvTransferConfiguration
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class DynamoCommunicationsInput(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
DynamoCommunicationsInput
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
kv_transfer: DynamoKvTransferConfiguration
|
|
31
|
+
additional_properties: Dict[str, Any] = {}
|
|
32
|
+
__properties: ClassVar[List[str]] = ["kv_transfer"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of DynamoCommunicationsInput from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
"additional_properties",
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of kv_transfer
|
|
76
|
+
if self.kv_transfer:
|
|
77
|
+
_dict['kv_transfer'] = self.kv_transfer.to_dict()
|
|
78
|
+
# puts key-value pairs in additional_properties in the top level
|
|
79
|
+
if self.additional_properties is not None:
|
|
80
|
+
for _key, _value in self.additional_properties.items():
|
|
81
|
+
_dict[_key] = _value
|
|
82
|
+
|
|
83
|
+
return _dict
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
|
+
"""Create an instance of DynamoCommunicationsInput from a dict"""
|
|
88
|
+
if obj is None:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
if not isinstance(obj, dict):
|
|
92
|
+
return cls.model_validate(obj)
|
|
93
|
+
|
|
94
|
+
_obj = cls.model_validate({
|
|
95
|
+
"kv_transfer": DynamoKvTransferConfiguration.from_dict(obj["kv_transfer"]) if obj.get("kv_transfer") is not None else None
|
|
96
|
+
})
|
|
97
|
+
# store additional fields in additional_properties
|
|
98
|
+
for _key in obj.keys():
|
|
99
|
+
if _key not in cls.__properties:
|
|
100
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
101
|
+
|
|
102
|
+
return _obj
|
|
103
|
+
|
|
104
|
+
|