sagemaker-hyperpod 3.0.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.
- sagemaker/__init__.py +0 -0
- sagemaker/hyperpod/__init__.py +2 -0
- sagemaker/hyperpod/cli/__init__.py +0 -0
- sagemaker/hyperpod/cli/clients/__init__.py +12 -0
- sagemaker/hyperpod/cli/clients/kubernetes_client.py +365 -0
- sagemaker/hyperpod/cli/commands/__init__.py +0 -0
- sagemaker/hyperpod/cli/commands/cluster.py +627 -0
- sagemaker/hyperpod/cli/commands/inference.py +659 -0
- sagemaker/hyperpod/cli/commands/training.py +347 -0
- sagemaker/hyperpod/cli/constants/__init__.py +0 -0
- sagemaker/hyperpod/cli/constants/command_constants.py +105 -0
- sagemaker/hyperpod/cli/constants/exception_constants.py +13 -0
- sagemaker/hyperpod/cli/constants/hyperpod_instance_types.py +100 -0
- sagemaker/hyperpod/cli/constants/kueue_constants.py +17 -0
- sagemaker/hyperpod/cli/constants/pytorch_constants.py +15 -0
- sagemaker/hyperpod/cli/hyp_cli.py +132 -0
- sagemaker/hyperpod/cli/inference_utils.py +121 -0
- sagemaker/hyperpod/cli/service/__init__.py +12 -0
- sagemaker/hyperpod/cli/service/cancel_training_job.py +70 -0
- sagemaker/hyperpod/cli/service/discover_namespaces.py +108 -0
- sagemaker/hyperpod/cli/service/exec_command.py +75 -0
- sagemaker/hyperpod/cli/service/get_logs.py +136 -0
- sagemaker/hyperpod/cli/service/get_namespaces.py +59 -0
- sagemaker/hyperpod/cli/service/get_training_job.py +110 -0
- sagemaker/hyperpod/cli/service/list_pods.py +138 -0
- sagemaker/hyperpod/cli/service/list_training_jobs.py +178 -0
- sagemaker/hyperpod/cli/service/self_subject_access_review.py +47 -0
- sagemaker/hyperpod/cli/telemetry/__init__.py +12 -0
- sagemaker/hyperpod/cli/telemetry/user_agent.py +36 -0
- sagemaker/hyperpod/cli/templates/__init__.py +12 -0
- sagemaker/hyperpod/cli/templates/k8s_pytorch_job_template.py +74 -0
- sagemaker/hyperpod/cli/training_utils.py +200 -0
- sagemaker/hyperpod/cli/utils.py +183 -0
- sagemaker/hyperpod/cli/validators/__init__.py +12 -0
- sagemaker/hyperpod/cli/validators/cluster_validator.py +52 -0
- sagemaker/hyperpod/cli/validators/job_validator.py +346 -0
- sagemaker/hyperpod/cli/validators/validator.py +75 -0
- sagemaker/hyperpod/common/__init__.py +0 -0
- sagemaker/hyperpod/common/config/__init__.py +1 -0
- sagemaker/hyperpod/common/config/metadata.py +18 -0
- sagemaker/hyperpod/common/utils.py +299 -0
- sagemaker/hyperpod/inference/__init__.py +11 -0
- sagemaker/hyperpod/inference/config/__init__.py +0 -0
- sagemaker/hyperpod/inference/config/constants.py +18 -0
- sagemaker/hyperpod/inference/config/hp_endpoint_config.py +767 -0
- sagemaker/hyperpod/inference/config/hp_jumpstart_endpoint_config.py +572 -0
- sagemaker/hyperpod/inference/hp_endpoint.py +203 -0
- sagemaker/hyperpod/inference/hp_endpoint_base.py +223 -0
- sagemaker/hyperpod/inference/hp_jumpstart_endpoint.py +232 -0
- sagemaker/hyperpod/observability/MonitoringConfig.py +10 -0
- sagemaker/hyperpod/observability/__init__.py +0 -0
- sagemaker/hyperpod/observability/constants.py +2 -0
- sagemaker/hyperpod/observability/utils.py +64 -0
- sagemaker/hyperpod/training/__init__.py +9 -0
- sagemaker/hyperpod/training/config/__init__.py +1 -0
- sagemaker/hyperpod/training/config/hyperpod_pytorch_job_config.py +2977 -0
- sagemaker/hyperpod/training/config/hyperpod_pytorch_job_status.py +3083 -0
- sagemaker/hyperpod/training/hyperpod_pytorch_job.py +253 -0
- sagemaker_hyperpod-3.0.0.dist-info/METADATA +534 -0
- sagemaker_hyperpod-3.0.0.dist-info/RECORD +66 -0
- sagemaker_hyperpod-3.0.0.dist-info/WHEEL +5 -0
- sagemaker_hyperpod-3.0.0.dist-info/entry_points.txt +2 -0
- sagemaker_hyperpod-3.0.0.dist-info/licenses/LICENSE +175 -0
- sagemaker_hyperpod-3.0.0.dist-info/licenses/NOTICE +1 -0
- sagemaker_hyperpod-3.0.0.dist-info/top_level.txt +1 -0
- sagemaker_hyperpod-3.0.0.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,767 @@
|
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
2
|
+
from typing import Optional, List, Dict, Union, Literal
|
|
3
|
+
from sagemaker.hyperpod.common.config import *
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Dimensions(BaseModel):
|
|
7
|
+
model_config = ConfigDict(extra="forbid")
|
|
8
|
+
|
|
9
|
+
name: str = Field(description="CloudWatch Metric dimension name")
|
|
10
|
+
value: str = Field(description="CloudWatch Metric dimension value")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CloudWatchTrigger(BaseModel):
|
|
14
|
+
"""CloudWatch metric trigger to use for autoscaling"""
|
|
15
|
+
|
|
16
|
+
model_config = ConfigDict(extra="forbid")
|
|
17
|
+
|
|
18
|
+
dimensions: Optional[List[Dimensions]] = Field(
|
|
19
|
+
default=None, description="Dimensions for Cloudwatch metrics"
|
|
20
|
+
)
|
|
21
|
+
metricCollectionPeriod: Optional[int] = Field(
|
|
22
|
+
default=300,
|
|
23
|
+
alias="metric_collection_period",
|
|
24
|
+
description="Defines the Period for CloudWatch query",
|
|
25
|
+
)
|
|
26
|
+
metricCollectionStartTime: Optional[int] = Field(
|
|
27
|
+
default=300,
|
|
28
|
+
alias="metric_collection_start_time",
|
|
29
|
+
description="Defines the StartTime for CloudWatch query",
|
|
30
|
+
)
|
|
31
|
+
metricName: Optional[str] = Field(
|
|
32
|
+
default=None,
|
|
33
|
+
alias="metric_name",
|
|
34
|
+
description="Metric name to query for Cloudwatch trigger",
|
|
35
|
+
)
|
|
36
|
+
metricStat: Optional[str] = Field(
|
|
37
|
+
default="Average",
|
|
38
|
+
alias="metric_stat",
|
|
39
|
+
description="Statistics metric to be used by Trigger. Used to define Stat for CloudWatch query. Default is Average.",
|
|
40
|
+
)
|
|
41
|
+
metricType: Optional[Literal["Value", "Average"]] = Field(
|
|
42
|
+
default="Average",
|
|
43
|
+
alias="metric_type",
|
|
44
|
+
description="The type of metric to be used by HPA. Enum: AverageValue - Uses average value of metric per pod, Value - Uses absolute metric value",
|
|
45
|
+
)
|
|
46
|
+
minValue: Optional[float] = Field(
|
|
47
|
+
default=0,
|
|
48
|
+
alias="min_value",
|
|
49
|
+
description="Minimum metric value used in case of empty response from CloudWatch. Default is 0.",
|
|
50
|
+
)
|
|
51
|
+
name: Optional[str] = Field(
|
|
52
|
+
default=None, description="Name for the CloudWatch trigger"
|
|
53
|
+
)
|
|
54
|
+
namespace: Optional[str] = Field(
|
|
55
|
+
default=None, description="AWS CloudWatch namespace for metric"
|
|
56
|
+
)
|
|
57
|
+
targetValue: Optional[float] = Field(
|
|
58
|
+
default=None,
|
|
59
|
+
alias="target_value",
|
|
60
|
+
description="TargetValue for CloudWatch metric",
|
|
61
|
+
)
|
|
62
|
+
useCachedMetrics: Optional[bool] = Field(
|
|
63
|
+
default=True,
|
|
64
|
+
alias="use_cached_metrics",
|
|
65
|
+
description="Enable caching of metric values during polling interval. Default is true",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class PrometheusTrigger(BaseModel):
|
|
70
|
+
"""Prometheus metric trigger to use for autoscaling"""
|
|
71
|
+
|
|
72
|
+
model_config = ConfigDict(extra="forbid")
|
|
73
|
+
|
|
74
|
+
customHeaders: Optional[str] = Field(
|
|
75
|
+
default=None,
|
|
76
|
+
alias="custom_headers",
|
|
77
|
+
description="Custom headers to include while querying the prometheus endpoint.",
|
|
78
|
+
)
|
|
79
|
+
metricType: Optional[Literal["Value", "Average"]] = Field(
|
|
80
|
+
default="Average",
|
|
81
|
+
alias="metric_type",
|
|
82
|
+
description="The type of metric to be used by HPA. Enum: AverageValue - Uses average value of metric per pod, Value - Uses absolute metric value",
|
|
83
|
+
)
|
|
84
|
+
name: Optional[str] = Field(
|
|
85
|
+
default=None, description="Name for the Prometheus trigger"
|
|
86
|
+
)
|
|
87
|
+
namespace: Optional[str] = Field(
|
|
88
|
+
default=None, description="Namespace for namespaced queries"
|
|
89
|
+
)
|
|
90
|
+
query: Optional[str] = Field(
|
|
91
|
+
default=None, description="PromQLQuery for the metric."
|
|
92
|
+
)
|
|
93
|
+
serverAddress: Optional[str] = Field(
|
|
94
|
+
default=None,
|
|
95
|
+
alias="server_address",
|
|
96
|
+
description="Server address for AMP workspace",
|
|
97
|
+
)
|
|
98
|
+
targetValue: Optional[float] = Field(
|
|
99
|
+
default=None,
|
|
100
|
+
alias="target_value",
|
|
101
|
+
description="Target metric value for scaling",
|
|
102
|
+
)
|
|
103
|
+
useCachedMetrics: Optional[bool] = Field(
|
|
104
|
+
default=True,
|
|
105
|
+
alias="use_cached_metrics",
|
|
106
|
+
description="Enable caching of metric values during polling interval. Default is true",
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class AutoScalingSpec(BaseModel):
|
|
111
|
+
model_config = ConfigDict(extra="forbid")
|
|
112
|
+
|
|
113
|
+
cloudWatchTrigger: Optional[CloudWatchTrigger] = Field(
|
|
114
|
+
default=None,
|
|
115
|
+
alias="cloud_watch_trigger",
|
|
116
|
+
description="CloudWatch metric trigger to use for autoscaling",
|
|
117
|
+
)
|
|
118
|
+
cooldownPeriod: Optional[int] = Field(
|
|
119
|
+
default=300,
|
|
120
|
+
alias="cooldown_period",
|
|
121
|
+
description="The period to wait after the last trigger reported active before scaling the resource back to 0. Default 300 seconds.",
|
|
122
|
+
)
|
|
123
|
+
initialCooldownPeriod: Optional[int] = Field(
|
|
124
|
+
default=300,
|
|
125
|
+
alias="initial_cooldown_period",
|
|
126
|
+
description="The delay before the cooldownPeriod starts after the initial creation of the ScaledObject. Default 300 seconds.",
|
|
127
|
+
)
|
|
128
|
+
maxReplicaCount: Optional[int] = Field(
|
|
129
|
+
default=5,
|
|
130
|
+
alias="max_replica_count",
|
|
131
|
+
description="The maximum number of model pods to scale to. Default 5.",
|
|
132
|
+
)
|
|
133
|
+
minReplicaCount: Optional[int] = Field(
|
|
134
|
+
default=1,
|
|
135
|
+
alias="min_replica_count",
|
|
136
|
+
description="The minimum number of model pods to scale down to. Default 1.",
|
|
137
|
+
)
|
|
138
|
+
pollingInterval: Optional[int] = Field(
|
|
139
|
+
default=30,
|
|
140
|
+
alias="polling_interval",
|
|
141
|
+
description="This is the interval to check each trigger on. Default 30 seconds.",
|
|
142
|
+
)
|
|
143
|
+
prometheusTrigger: Optional[PrometheusTrigger] = Field(
|
|
144
|
+
default=None,
|
|
145
|
+
alias="prometheus_trigger",
|
|
146
|
+
description="Prometheus metric trigger to use for autoscaling",
|
|
147
|
+
)
|
|
148
|
+
scaleDownStabilizationTime: Optional[int] = Field(
|
|
149
|
+
default=300,
|
|
150
|
+
alias="scale_down_stabilization_time",
|
|
151
|
+
description="The time window to stabilize for HPA before scaling down. Default 300 seconds.",
|
|
152
|
+
)
|
|
153
|
+
scaleUpStabilizationTime: Optional[int] = Field(
|
|
154
|
+
default=0,
|
|
155
|
+
alias="scale_up_stabilization_time",
|
|
156
|
+
description="The time window to stabilize for HPA before scaling up. Default 0 seconds.",
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class ModelMetrics(BaseModel):
|
|
161
|
+
"""Configuration for model container metrics scraping"""
|
|
162
|
+
|
|
163
|
+
model_config = ConfigDict(extra="forbid")
|
|
164
|
+
|
|
165
|
+
path: Optional[str] = Field(
|
|
166
|
+
default="/metrics", description="Path where the model exposes metrics"
|
|
167
|
+
)
|
|
168
|
+
port: Optional[int] = Field(
|
|
169
|
+
default=8080,
|
|
170
|
+
description="Port where the model exposes metrics. If not specified, a default port will be used.",
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class Metrics(BaseModel):
|
|
175
|
+
"""Configuration for metrics collection and exposure"""
|
|
176
|
+
|
|
177
|
+
model_config = ConfigDict(extra="forbid")
|
|
178
|
+
|
|
179
|
+
enabled: Optional[bool] = Field(
|
|
180
|
+
default=False, description="Enable metrics collection for this model deployment"
|
|
181
|
+
)
|
|
182
|
+
metricsScrapeIntervalSeconds: Optional[int] = Field(
|
|
183
|
+
default=15,
|
|
184
|
+
alias="metrics_scrape_interval_seconds",
|
|
185
|
+
description="Scrape interval in seconds for metrics collection from sidecar and model container.",
|
|
186
|
+
)
|
|
187
|
+
modelMetrics: Optional[ModelMetrics] = Field(
|
|
188
|
+
default=None,
|
|
189
|
+
alias="model_metrics",
|
|
190
|
+
description="Configuration for model container metrics scraping",
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class FsxStorage(BaseModel):
|
|
195
|
+
model_config = ConfigDict(extra="forbid")
|
|
196
|
+
|
|
197
|
+
dnsName: Optional[str] = Field(
|
|
198
|
+
default=None, alias="dns_name", description="FSX File System DNS Name"
|
|
199
|
+
)
|
|
200
|
+
fileSystemId: str = Field(alias="file_system_id", description="FSX File System ID")
|
|
201
|
+
mountName: Optional[str] = Field(
|
|
202
|
+
default=None, alias="mount_name", description="FSX File System Mount Name"
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class S3Storage(BaseModel):
|
|
207
|
+
model_config = ConfigDict(extra="forbid")
|
|
208
|
+
|
|
209
|
+
bucketName: str = Field(alias="bucket_name", description="S3 bucket location")
|
|
210
|
+
region: str = Field(description="S3 bucket region")
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class ModelSourceConfig(BaseModel):
|
|
214
|
+
model_config = ConfigDict(extra="forbid")
|
|
215
|
+
|
|
216
|
+
fsxStorage: Optional[FsxStorage] = Field(default=None, alias="fsx_storage")
|
|
217
|
+
modelLocation: Optional[str] = Field(
|
|
218
|
+
default=None,
|
|
219
|
+
alias="model_location",
|
|
220
|
+
description="Sepcific location where the model data exists",
|
|
221
|
+
)
|
|
222
|
+
modelSourceType: Literal["fsx", "s3"] = Field(alias="model_source_type")
|
|
223
|
+
prefetchEnabled: Optional[bool] = Field(
|
|
224
|
+
default=False,
|
|
225
|
+
alias="prefetch_enabled",
|
|
226
|
+
description="In case the model seems to fit within the instance's memory (VRAM), this option can be used to pre-fetch the model to RAM and then the inference server will load to the GPU/CPU device thereafter.",
|
|
227
|
+
)
|
|
228
|
+
s3Storage: Optional[S3Storage] = Field(default=None, alias="s3_storage")
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
class Tags(BaseModel):
|
|
232
|
+
model_config = ConfigDict(extra="forbid")
|
|
233
|
+
|
|
234
|
+
name: str
|
|
235
|
+
value: str
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class TlsConfig(BaseModel):
|
|
239
|
+
"""Configurations for TLS"""
|
|
240
|
+
|
|
241
|
+
model_config = ConfigDict(extra="forbid")
|
|
242
|
+
|
|
243
|
+
tlsCertificateOutputS3Uri: Optional[str] = Field(
|
|
244
|
+
default=None, alias="tls_certificate_output_s3_uri"
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class ConfigMapKeyRef(BaseModel):
|
|
249
|
+
"""Selects a key of a ConfigMap."""
|
|
250
|
+
|
|
251
|
+
model_config = ConfigDict(extra="forbid")
|
|
252
|
+
|
|
253
|
+
key: str = Field(description="The key to select.")
|
|
254
|
+
name: Optional[str] = Field(
|
|
255
|
+
default="",
|
|
256
|
+
description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
|
|
257
|
+
)
|
|
258
|
+
optional: Optional[bool] = Field(
|
|
259
|
+
default=None,
|
|
260
|
+
description="Specify whether the ConfigMap or its key must be defined",
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class FieldRef(BaseModel):
|
|
265
|
+
"""Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs."""
|
|
266
|
+
|
|
267
|
+
model_config = ConfigDict(extra="forbid")
|
|
268
|
+
|
|
269
|
+
apiVersion: Optional[str] = Field(
|
|
270
|
+
default=None,
|
|
271
|
+
alias="api_version",
|
|
272
|
+
description='Version of the schema the FieldPath is written in terms of, defaults to "v1".',
|
|
273
|
+
)
|
|
274
|
+
fieldPath: str = Field(
|
|
275
|
+
alias="field_path",
|
|
276
|
+
description="Path of the field to select in the specified API version.",
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class ResourceFieldRef(BaseModel):
|
|
281
|
+
"""Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported."""
|
|
282
|
+
|
|
283
|
+
model_config = ConfigDict(extra="forbid")
|
|
284
|
+
|
|
285
|
+
containerName: Optional[str] = Field(
|
|
286
|
+
default=None,
|
|
287
|
+
alias="container_name",
|
|
288
|
+
description="Container name: required for volumes, optional for env vars",
|
|
289
|
+
)
|
|
290
|
+
divisor: Optional[Union[int, str]] = Field(
|
|
291
|
+
default=None,
|
|
292
|
+
description='Specifies the output format of the exposed resources, defaults to "1"',
|
|
293
|
+
)
|
|
294
|
+
resource: str = Field(description="Required: resource to select")
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class SecretKeyRef(BaseModel):
|
|
298
|
+
"""Selects a key of a secret in the pod's namespace"""
|
|
299
|
+
|
|
300
|
+
model_config = ConfigDict(extra="forbid")
|
|
301
|
+
|
|
302
|
+
key: str = Field(
|
|
303
|
+
description="The key of the secret to select from. Must be a valid secret key."
|
|
304
|
+
)
|
|
305
|
+
name: Optional[str] = Field(
|
|
306
|
+
default="",
|
|
307
|
+
description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
|
|
308
|
+
)
|
|
309
|
+
optional: Optional[bool] = Field(
|
|
310
|
+
default=None,
|
|
311
|
+
description="Specify whether the Secret or its key must be defined",
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
class ValueFrom(BaseModel):
|
|
316
|
+
"""Source for the environment variable's value. Cannot be used if value is not empty."""
|
|
317
|
+
|
|
318
|
+
model_config = ConfigDict(extra="forbid")
|
|
319
|
+
|
|
320
|
+
configMapKeyRef: Optional[ConfigMapKeyRef] = Field(
|
|
321
|
+
default=None,
|
|
322
|
+
alias="config_map_key_ref",
|
|
323
|
+
description="Selects a key of a ConfigMap.",
|
|
324
|
+
)
|
|
325
|
+
fieldRef: Optional[FieldRef] = Field(
|
|
326
|
+
default=None,
|
|
327
|
+
alias="field_ref",
|
|
328
|
+
description="Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.",
|
|
329
|
+
)
|
|
330
|
+
resourceFieldRef: Optional[ResourceFieldRef] = Field(
|
|
331
|
+
default=None,
|
|
332
|
+
alias="resource_field_ref",
|
|
333
|
+
description="Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.",
|
|
334
|
+
)
|
|
335
|
+
secretKeyRef: Optional[SecretKeyRef] = Field(
|
|
336
|
+
default=None,
|
|
337
|
+
alias="secret_key_ref",
|
|
338
|
+
description="Selects a key of a secret in the pod's namespace",
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class EnvironmentVariables(BaseModel):
|
|
343
|
+
"""EnvVar represents an environment variable present in a Container."""
|
|
344
|
+
|
|
345
|
+
model_config = ConfigDict(extra="forbid")
|
|
346
|
+
|
|
347
|
+
name: str = Field(
|
|
348
|
+
description="Name of the environment variable. Must be a C_IDENTIFIER."
|
|
349
|
+
)
|
|
350
|
+
value: Optional[str] = Field(
|
|
351
|
+
default=None,
|
|
352
|
+
description='Variable references $(VAR_NAME) are expanded using the previously defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "".',
|
|
353
|
+
)
|
|
354
|
+
valueFrom: Optional[ValueFrom] = Field(
|
|
355
|
+
default=None,
|
|
356
|
+
alias="value_from",
|
|
357
|
+
description="Source for the environment variable's value. Cannot be used if value is not empty.",
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
class ModelInvocationPort(BaseModel):
|
|
362
|
+
"""Defines the port at which the model server will listen to the invocation requests."""
|
|
363
|
+
|
|
364
|
+
model_config = ConfigDict(extra="forbid")
|
|
365
|
+
|
|
366
|
+
containerPort: int = Field(
|
|
367
|
+
alias="container_port",
|
|
368
|
+
description="Port on which the model server will be listening",
|
|
369
|
+
)
|
|
370
|
+
name: Optional[str] = Field(
|
|
371
|
+
default="http",
|
|
372
|
+
description="This is name for the port within the deployed container where the model will listen. This will be referred to by the Load Balancer Service. This must be an IANA_SVC_NAME (for eg. http) and unique within the pod.",
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
class ModelVolumeMount(BaseModel):
|
|
377
|
+
"""Defines the volume where model will be loaded"""
|
|
378
|
+
|
|
379
|
+
model_config = ConfigDict(extra="forbid")
|
|
380
|
+
|
|
381
|
+
mountPath: Optional[str] = Field(
|
|
382
|
+
default="/opt/ml/model",
|
|
383
|
+
alias="mount_path",
|
|
384
|
+
description="This is the path within the container where the model data will be available for the inference server to load it to GPU,CPU or other device",
|
|
385
|
+
)
|
|
386
|
+
name: str = Field(description="Name of the model volume mount")
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
class Claims(BaseModel):
|
|
390
|
+
"""ResourceClaim references one entry in PodSpec.ResourceClaims."""
|
|
391
|
+
|
|
392
|
+
model_config = ConfigDict(extra="forbid")
|
|
393
|
+
|
|
394
|
+
name: str = Field(
|
|
395
|
+
description="Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container."
|
|
396
|
+
)
|
|
397
|
+
request: Optional[str] = Field(
|
|
398
|
+
default=None,
|
|
399
|
+
description="Request is the name chosen for a request in the referenced claim. If empty, everything from the claim is made available, otherwise only the result of this request.",
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
class Resources(BaseModel):
|
|
404
|
+
"""Defines the Resources in terms of CPU, GPU, Memory needed for the model to be deployed"""
|
|
405
|
+
|
|
406
|
+
model_config = ConfigDict(extra="forbid")
|
|
407
|
+
|
|
408
|
+
claims: Optional[List[Claims]] = Field(
|
|
409
|
+
default=None,
|
|
410
|
+
description="Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. This field is immutable. It can only be set for containers.",
|
|
411
|
+
)
|
|
412
|
+
limits: Optional[Dict[str, Union[int, str]]] = Field(
|
|
413
|
+
default=None,
|
|
414
|
+
description="Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
|
|
415
|
+
)
|
|
416
|
+
requests: Optional[Dict[str, Union[int, str]]] = Field(
|
|
417
|
+
default=None,
|
|
418
|
+
description="Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
class Worker(BaseModel):
|
|
423
|
+
"""Details of the worker"""
|
|
424
|
+
|
|
425
|
+
model_config = ConfigDict(extra="forbid")
|
|
426
|
+
|
|
427
|
+
environmentVariables: Optional[List[EnvironmentVariables]] = Field(
|
|
428
|
+
default=None,
|
|
429
|
+
alias="environment_variables",
|
|
430
|
+
description="List of environment variables to set in the container. Cannot be updated.",
|
|
431
|
+
)
|
|
432
|
+
image: str = Field(description="The name of the inference server image to be used")
|
|
433
|
+
modelInvocationPort: ModelInvocationPort = Field(
|
|
434
|
+
alias="model_invocation_port",
|
|
435
|
+
description="Defines the port at which the model server will listen to the invocation requests.",
|
|
436
|
+
)
|
|
437
|
+
modelVolumeMount: ModelVolumeMount = Field(
|
|
438
|
+
alias="model_volume_mount",
|
|
439
|
+
description="Defines the volume where model will be loaded",
|
|
440
|
+
)
|
|
441
|
+
resources: Resources = Field(
|
|
442
|
+
description="Defines the Resources in terms of CPU, GPU, Memory needed for the model to be deployed"
|
|
443
|
+
)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
class _HPEndpoint(BaseModel):
|
|
447
|
+
"""InferenceEndpointConfigSpec defines the desired state of InferenceEndpointConfig."""
|
|
448
|
+
|
|
449
|
+
model_config = ConfigDict(extra="ignore")
|
|
450
|
+
|
|
451
|
+
InitialReplicaCount: Optional[int] = Field(
|
|
452
|
+
default=None,
|
|
453
|
+
alias="initial_replica_count",
|
|
454
|
+
description="Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.",
|
|
455
|
+
)
|
|
456
|
+
autoScalingSpec: Optional[AutoScalingSpec] = Field(
|
|
457
|
+
default=None, alias="auto_scaling_spec"
|
|
458
|
+
)
|
|
459
|
+
endpointName: Optional[str] = Field(
|
|
460
|
+
default=None,
|
|
461
|
+
alias="endpoint_name",
|
|
462
|
+
description="Name used for Sagemaker Endpoint Name of sagemaker endpoint. Defaults to empty string which represents that Sagemaker endpoint will not be created.",
|
|
463
|
+
)
|
|
464
|
+
instanceType: str = Field(
|
|
465
|
+
alias="instance_type", description="Instance Type to deploy the model on"
|
|
466
|
+
)
|
|
467
|
+
invocationEndpoint: Optional[str] = Field(
|
|
468
|
+
default="invocations",
|
|
469
|
+
alias="invocation_endpoint",
|
|
470
|
+
description="The invocation endpoint of the model server. http://<host>:<port>/ would be pre-populated based on the other fields. Please fill in the path after http://<host>:<port>/ specific to your model server.",
|
|
471
|
+
)
|
|
472
|
+
metrics: Optional[Metrics] = Field(
|
|
473
|
+
default=None, description="Configuration for metrics collection and exposure"
|
|
474
|
+
)
|
|
475
|
+
modelName: str = Field(
|
|
476
|
+
alias="model_name",
|
|
477
|
+
description="Name of model that will be created on Sagemaker",
|
|
478
|
+
)
|
|
479
|
+
modelSourceConfig: ModelSourceConfig = Field(alias="model_source_config")
|
|
480
|
+
modelVersion: Optional[str] = Field(
|
|
481
|
+
default=None,
|
|
482
|
+
alias="model_version",
|
|
483
|
+
description="Version of the model used in creating sagemaker endpoint",
|
|
484
|
+
)
|
|
485
|
+
replicas: Optional[int] = Field(
|
|
486
|
+
default=1,
|
|
487
|
+
description="The desired number of inference server replicas. Default 1.",
|
|
488
|
+
)
|
|
489
|
+
tags: Optional[List[Tags]] = Field(
|
|
490
|
+
default=None,
|
|
491
|
+
description="Mentions the tags to be added to the Sagemaker Endpoint",
|
|
492
|
+
)
|
|
493
|
+
tlsConfig: Optional[TlsConfig] = Field(
|
|
494
|
+
default=None, alias="tls_config", description="Configurations for TLS"
|
|
495
|
+
)
|
|
496
|
+
worker: Worker = Field(description="Details of the worker")
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
class Conditions(BaseModel):
|
|
500
|
+
"""DeploymentCondition describes the state of a deployment at a certain point."""
|
|
501
|
+
|
|
502
|
+
model_config = ConfigDict(extra="forbid")
|
|
503
|
+
|
|
504
|
+
lastTransitionTime: Optional[str] = Field(
|
|
505
|
+
default=None,
|
|
506
|
+
alias="last_transition_time",
|
|
507
|
+
description="Last time the condition transitioned from one status to another.",
|
|
508
|
+
)
|
|
509
|
+
lastUpdateTime: Optional[str] = Field(
|
|
510
|
+
default=None,
|
|
511
|
+
alias="last_update_time",
|
|
512
|
+
description="The last time this condition was updated.",
|
|
513
|
+
)
|
|
514
|
+
message: Optional[str] = Field(
|
|
515
|
+
default=None,
|
|
516
|
+
description="A human readable message indicating details about the transition.",
|
|
517
|
+
)
|
|
518
|
+
reason: Optional[str] = Field(
|
|
519
|
+
default=None, description="The reason for the condition's last transition."
|
|
520
|
+
)
|
|
521
|
+
status: str = Field(
|
|
522
|
+
description="Status of the condition, one of True, False, Unknown."
|
|
523
|
+
)
|
|
524
|
+
type: str = Field(description="Type of deployment condition.")
|
|
525
|
+
observedGeneration: Optional[int] = Field(
|
|
526
|
+
default=None,
|
|
527
|
+
alias="observed_generation",
|
|
528
|
+
description="observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.",
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
class Status(BaseModel):
|
|
533
|
+
"""Status of the Deployment Object"""
|
|
534
|
+
|
|
535
|
+
model_config = ConfigDict(extra="forbid")
|
|
536
|
+
|
|
537
|
+
availableReplicas: Optional[int] = Field(
|
|
538
|
+
default=None,
|
|
539
|
+
alias="available_replicas",
|
|
540
|
+
description="Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.",
|
|
541
|
+
)
|
|
542
|
+
collisionCount: Optional[int] = Field(
|
|
543
|
+
default=None,
|
|
544
|
+
alias="collision_count",
|
|
545
|
+
description="Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.",
|
|
546
|
+
)
|
|
547
|
+
conditions: Optional[List[Conditions]] = Field(
|
|
548
|
+
default=None,
|
|
549
|
+
description="Represents the latest available observations of a deployment's current state.",
|
|
550
|
+
)
|
|
551
|
+
observedGeneration: Optional[int] = Field(
|
|
552
|
+
default=None,
|
|
553
|
+
alias="observed_generation",
|
|
554
|
+
description="The generation observed by the deployment controller.",
|
|
555
|
+
)
|
|
556
|
+
readyReplicas: Optional[int] = Field(
|
|
557
|
+
default=None,
|
|
558
|
+
alias="ready_replicas",
|
|
559
|
+
description="readyReplicas is the number of pods targeted by this Deployment with a Ready Condition.",
|
|
560
|
+
)
|
|
561
|
+
replicas: Optional[int] = Field(
|
|
562
|
+
default=None,
|
|
563
|
+
description="Total number of non-terminated pods targeted by this deployment (their labels match the selector).",
|
|
564
|
+
)
|
|
565
|
+
unavailableReplicas: Optional[int] = Field(
|
|
566
|
+
default=None,
|
|
567
|
+
alias="unavailable_replicas",
|
|
568
|
+
description="Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.",
|
|
569
|
+
)
|
|
570
|
+
updatedReplicas: Optional[int] = Field(
|
|
571
|
+
default=None,
|
|
572
|
+
alias="updated_replicas",
|
|
573
|
+
description="Total number of non-terminated pods targeted by this deployment that have the desired template spec.",
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
class DeploymentStatus(BaseModel):
|
|
578
|
+
"""Details of the native kubernetes deployment that hosts the model"""
|
|
579
|
+
|
|
580
|
+
model_config = ConfigDict(extra="forbid")
|
|
581
|
+
|
|
582
|
+
deploymentObjectOverallState: Optional[str] = Field(
|
|
583
|
+
default=None,
|
|
584
|
+
alias="deployment_object_overall_state",
|
|
585
|
+
description="Overall State of the Deployment Object",
|
|
586
|
+
)
|
|
587
|
+
lastUpdated: str = Field(alias="last_updated", description="Last Update Time")
|
|
588
|
+
message: Optional[str] = Field(
|
|
589
|
+
default=None,
|
|
590
|
+
description="Message populated in the root CRD while updating the status of underlying Deployment",
|
|
591
|
+
)
|
|
592
|
+
name: str = Field(description="Name of the Deployment Object")
|
|
593
|
+
reason: Optional[str] = Field(
|
|
594
|
+
default=None,
|
|
595
|
+
description="Reason populated in the root CRD while updating the status of underlying Deployment",
|
|
596
|
+
)
|
|
597
|
+
status: Optional[Status] = Field(
|
|
598
|
+
default=None, description="Status of the Deployment Object"
|
|
599
|
+
)
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
class Sagemaker(BaseModel):
|
|
603
|
+
"""Status of the SageMaker endpoint"""
|
|
604
|
+
|
|
605
|
+
model_config = ConfigDict(extra="forbid")
|
|
606
|
+
|
|
607
|
+
configArn: Optional[str] = Field(
|
|
608
|
+
default=None,
|
|
609
|
+
alias="config_arn",
|
|
610
|
+
description="The Amazon Resource Name (ARN) of the endpoint configuration.",
|
|
611
|
+
)
|
|
612
|
+
endpointArn: Optional[str] = Field(
|
|
613
|
+
default=None,
|
|
614
|
+
alias="endpoint_arn",
|
|
615
|
+
description="The Amazon Resource Name (ARN) of the SageMaker endpoint",
|
|
616
|
+
)
|
|
617
|
+
modelArn: Optional[str] = Field(
|
|
618
|
+
default=None,
|
|
619
|
+
alias="model_arn",
|
|
620
|
+
description="The ARN of the model created in SageMaker.",
|
|
621
|
+
)
|
|
622
|
+
state: str = Field(description="The current state of the SageMaker endpoint")
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
class Endpoints(BaseModel):
|
|
626
|
+
"""EndpointStatus contains the status of SageMaker endpoints"""
|
|
627
|
+
|
|
628
|
+
model_config = ConfigDict(extra="forbid")
|
|
629
|
+
|
|
630
|
+
sagemaker: Optional[Sagemaker] = Field(
|
|
631
|
+
default=None, description="Status of the SageMaker endpoint"
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
class ModelMetrics(BaseModel):
|
|
636
|
+
"""Status of model container metrics collection"""
|
|
637
|
+
|
|
638
|
+
model_config = ConfigDict(extra="forbid")
|
|
639
|
+
|
|
640
|
+
path: Optional[str] = Field(
|
|
641
|
+
default=None, description="The path where metrics are available"
|
|
642
|
+
)
|
|
643
|
+
port: Optional[int] = Field(
|
|
644
|
+
default=None, description="The port on which metrics are exposed"
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
class MetricsStatus(BaseModel):
|
|
649
|
+
"""Status of metrics collection"""
|
|
650
|
+
|
|
651
|
+
model_config = ConfigDict(extra="forbid")
|
|
652
|
+
|
|
653
|
+
enabled: bool = Field(description="Whether metrics collection is enabled")
|
|
654
|
+
errorMessage: Optional[str] = Field(
|
|
655
|
+
default=None,
|
|
656
|
+
alias="error_message",
|
|
657
|
+
description="Error message if metrics collection is in error state",
|
|
658
|
+
)
|
|
659
|
+
metricsScrapeIntervalSeconds: Optional[int] = Field(
|
|
660
|
+
default=None,
|
|
661
|
+
alias="metrics_scrape_interval_seconds",
|
|
662
|
+
description="Scrape interval in seconds for metrics collection from sidecar and model container.",
|
|
663
|
+
)
|
|
664
|
+
modelMetrics: Optional[ModelMetrics] = Field(
|
|
665
|
+
default=None,
|
|
666
|
+
alias="model_metrics",
|
|
667
|
+
description="Status of model container metrics collection",
|
|
668
|
+
)
|
|
669
|
+
state: Optional[str] = Field(
|
|
670
|
+
default=None, description="Current state of metrics collection"
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
class TlsCertificate(BaseModel):
|
|
675
|
+
"""CertificateStatus represents the status of TLS certificates"""
|
|
676
|
+
|
|
677
|
+
model_config = ConfigDict(extra="forbid")
|
|
678
|
+
|
|
679
|
+
certificateARN: Optional[str] = Field(
|
|
680
|
+
default=None,
|
|
681
|
+
alias="certificate_arn",
|
|
682
|
+
description="The Amazon Resource Name (ARN) of the ACM certificate",
|
|
683
|
+
)
|
|
684
|
+
certificateDomainNames: Optional[List[str]] = Field(
|
|
685
|
+
default=None,
|
|
686
|
+
alias="certificate_domain_names",
|
|
687
|
+
description="The certificate domain names that is attached to the certificate",
|
|
688
|
+
)
|
|
689
|
+
certificateName: Optional[str] = Field(
|
|
690
|
+
default=None,
|
|
691
|
+
alias="certificate_name",
|
|
692
|
+
description="The certificate name of cert manager",
|
|
693
|
+
)
|
|
694
|
+
importedCertificates: Optional[List[str]] = Field(
|
|
695
|
+
default=None,
|
|
696
|
+
alias="imported_certificates",
|
|
697
|
+
description="Used for tracking the imported certificates to ACM",
|
|
698
|
+
)
|
|
699
|
+
issuerName: Optional[str] = Field(
|
|
700
|
+
default=None, alias="issuer_name", description="The issuer name of cert manager"
|
|
701
|
+
)
|
|
702
|
+
lastCertExpiryTime: Optional[str] = Field(
|
|
703
|
+
default=None,
|
|
704
|
+
alias="last_cert_expiry_time",
|
|
705
|
+
description="The last certificate expiry time",
|
|
706
|
+
)
|
|
707
|
+
tlsCertificateOutputS3Bucket: Optional[str] = Field(
|
|
708
|
+
default=None,
|
|
709
|
+
alias="tls_certificate_output_s3_bucket",
|
|
710
|
+
description="S3 bucket that stores the certificate that needs to be trusted",
|
|
711
|
+
)
|
|
712
|
+
tlsCertificateS3Keys: Optional[List[str]] = Field(
|
|
713
|
+
default=None,
|
|
714
|
+
alias="tls_certificate_s3_keys",
|
|
715
|
+
description="The output tls certificate S3 key that points to the .pem file",
|
|
716
|
+
)
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
class InferenceEndpointConfigStatus(BaseModel):
|
|
720
|
+
"""ModelDeploymentStatus defines the observed state of ModelDeployment"""
|
|
721
|
+
|
|
722
|
+
model_config = ConfigDict(extra="forbid")
|
|
723
|
+
|
|
724
|
+
conditions: Optional[List[Conditions]] = Field(
|
|
725
|
+
default=None,
|
|
726
|
+
description="Detailed conditions representing the state of the deployment",
|
|
727
|
+
)
|
|
728
|
+
deploymentStatus: Optional[DeploymentStatus] = Field(
|
|
729
|
+
default=None,
|
|
730
|
+
alias="deployment_status",
|
|
731
|
+
description="Details of the native kubernetes deployment that hosts the model",
|
|
732
|
+
)
|
|
733
|
+
endpoints: Optional[Endpoints] = Field(
|
|
734
|
+
default=None,
|
|
735
|
+
description="EndpointStatus contains the status of SageMaker endpoints",
|
|
736
|
+
)
|
|
737
|
+
metricsStatus: Optional[MetricsStatus] = Field(
|
|
738
|
+
default=None, alias="metrics_status", description="Status of metrics collection"
|
|
739
|
+
)
|
|
740
|
+
observedGeneration: Optional[int] = Field(
|
|
741
|
+
default=None,
|
|
742
|
+
alias="observed_generation",
|
|
743
|
+
description="Latest generation reconciled by controller",
|
|
744
|
+
)
|
|
745
|
+
replicas: Optional[int] = Field(
|
|
746
|
+
default=None, description="The observed number of inference server replicas."
|
|
747
|
+
)
|
|
748
|
+
selector: Optional[str] = Field(
|
|
749
|
+
default=None, description="LabelSelector for the deployment."
|
|
750
|
+
)
|
|
751
|
+
state: Optional[
|
|
752
|
+
Literal[
|
|
753
|
+
"DeploymentPending",
|
|
754
|
+
"DeploymentInProgress",
|
|
755
|
+
"DeploymentFailed",
|
|
756
|
+
"DeploymentComplete",
|
|
757
|
+
"DeletionPending",
|
|
758
|
+
"DeletionInProgress",
|
|
759
|
+
"DeletionFailed",
|
|
760
|
+
"DeletionComplete",
|
|
761
|
+
]
|
|
762
|
+
] = Field(default=None, description="Current phase of the model deployment")
|
|
763
|
+
tlsCertificate: Optional[TlsCertificate] = Field(
|
|
764
|
+
default=None,
|
|
765
|
+
alias="tls_certificate",
|
|
766
|
+
description="CertificateStatus represents the status of TLS certificates",
|
|
767
|
+
)
|