sagemaker-core 1.0.3__py3-none-any.whl → 1.0.5__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.
Potentially problematic release.
This version of sagemaker-core might be problematic. Click here for more details.
- sagemaker_core/main/code_injection/shape_dag.py +180 -2
- sagemaker_core/main/resources.py +457 -158
- sagemaker_core/main/shapes.py +405 -170
- sagemaker_core/main/utils.py +22 -37
- sagemaker_core/tools/constants.py +4 -0
- sagemaker_core/tools/data_extractor.py +20 -3
- sagemaker_core/tools/resources_codegen.py +2 -197
- sagemaker_core/tools/resources_extractor.py +1 -1
- sagemaker_core/tools/templates.py +1 -72
- {sagemaker_core-1.0.3.dist-info → sagemaker_core-1.0.5.dist-info}/METADATA +1 -1
- {sagemaker_core-1.0.3.dist-info → sagemaker_core-1.0.5.dist-info}/RECORD +14 -14
- {sagemaker_core-1.0.3.dist-info → sagemaker_core-1.0.5.dist-info}/WHEEL +1 -1
- {sagemaker_core-1.0.3.dist-info → sagemaker_core-1.0.5.dist-info}/LICENSE +0 -0
- {sagemaker_core-1.0.3.dist-info → sagemaker_core-1.0.5.dist-info}/top_level.txt +0 -0
sagemaker_core/main/resources.py
CHANGED
|
@@ -27,7 +27,6 @@ from sagemaker_core.main.code_injection.codec import transform
|
|
|
27
27
|
from sagemaker_core.main.code_injection.constants import Color
|
|
28
28
|
from sagemaker_core.main.utils import (
|
|
29
29
|
SageMakerClient,
|
|
30
|
-
SageMakerRuntimeClient,
|
|
31
30
|
ResourceIterator,
|
|
32
31
|
Unassigned,
|
|
33
32
|
get_textual_rich_logger,
|
|
@@ -35,7 +34,6 @@ from sagemaker_core.main.utils import (
|
|
|
35
34
|
pascal_to_snake,
|
|
36
35
|
is_not_primitive,
|
|
37
36
|
is_not_str_dict,
|
|
38
|
-
is_snake_case,
|
|
39
37
|
is_primitive_list,
|
|
40
38
|
serialize,
|
|
41
39
|
)
|
|
@@ -55,9 +53,9 @@ class Base(BaseModel):
|
|
|
55
53
|
|
|
56
54
|
@classmethod
|
|
57
55
|
def get_sagemaker_client(cls, session=None, region_name=None, service_name="sagemaker"):
|
|
58
|
-
return SageMakerClient(
|
|
59
|
-
|
|
60
|
-
)
|
|
56
|
+
return SageMakerClient(session=session, region_name=region_name).get_client(
|
|
57
|
+
service_name=service_name
|
|
58
|
+
)
|
|
61
59
|
|
|
62
60
|
@staticmethod
|
|
63
61
|
def get_updated_kwargs_with_configured_attributes(
|
|
@@ -3198,6 +3196,8 @@ class Cluster(Base):
|
|
|
3198
3196
|
creation_time: The time when the SageMaker Cluster is created.
|
|
3199
3197
|
failure_message: The failure message of the SageMaker HyperPod cluster.
|
|
3200
3198
|
vpc_config:
|
|
3199
|
+
orchestrator: The type of orchestrator used for the SageMaker HyperPod cluster.
|
|
3200
|
+
node_recovery: The node recovery mode configured for the SageMaker HyperPod cluster.
|
|
3201
3201
|
|
|
3202
3202
|
"""
|
|
3203
3203
|
|
|
@@ -3208,6 +3208,8 @@ class Cluster(Base):
|
|
|
3208
3208
|
failure_message: Optional[str] = Unassigned()
|
|
3209
3209
|
instance_groups: Optional[List[ClusterInstanceGroupDetails]] = Unassigned()
|
|
3210
3210
|
vpc_config: Optional[VpcConfig] = Unassigned()
|
|
3211
|
+
orchestrator: Optional[ClusterOrchestrator] = Unassigned()
|
|
3212
|
+
node_recovery: Optional[str] = Unassigned()
|
|
3211
3213
|
|
|
3212
3214
|
def get_name(self) -> str:
|
|
3213
3215
|
attributes = vars(self)
|
|
@@ -3252,6 +3254,8 @@ class Cluster(Base):
|
|
|
3252
3254
|
instance_groups: List[ClusterInstanceGroupSpecification],
|
|
3253
3255
|
vpc_config: Optional[VpcConfig] = Unassigned(),
|
|
3254
3256
|
tags: Optional[List[Tag]] = Unassigned(),
|
|
3257
|
+
orchestrator: Optional[ClusterOrchestrator] = Unassigned(),
|
|
3258
|
+
node_recovery: Optional[str] = Unassigned(),
|
|
3255
3259
|
session: Optional[Session] = None,
|
|
3256
3260
|
region: Optional[str] = None,
|
|
3257
3261
|
) -> Optional["Cluster"]:
|
|
@@ -3263,6 +3267,8 @@ class Cluster(Base):
|
|
|
3263
3267
|
instance_groups: The instance groups to be created in the SageMaker HyperPod cluster.
|
|
3264
3268
|
vpc_config:
|
|
3265
3269
|
tags: Custom tags for managing the SageMaker HyperPod cluster as an Amazon Web Services resource. You can add tags to your cluster in the same way you add them in other Amazon Web Services services that support tagging. To learn more about tagging Amazon Web Services resources in general, see Tagging Amazon Web Services Resources User Guide.
|
|
3270
|
+
orchestrator: The type of orchestrator to use for the SageMaker HyperPod cluster. Currently, the only supported value is "eks", which is to use an Amazon Elastic Kubernetes Service (EKS) cluster as the orchestrator.
|
|
3271
|
+
node_recovery: The node recovery mode for the SageMaker HyperPod cluster. When set to Automatic, SageMaker HyperPod will automatically reboot or replace faulty nodes when issues are detected. When set to None, cluster administrators will need to manually manage any faulty cluster instances.
|
|
3266
3272
|
session: Boto3 session.
|
|
3267
3273
|
region: Region name.
|
|
3268
3274
|
|
|
@@ -3296,6 +3302,8 @@ class Cluster(Base):
|
|
|
3296
3302
|
"InstanceGroups": instance_groups,
|
|
3297
3303
|
"VpcConfig": vpc_config,
|
|
3298
3304
|
"Tags": tags,
|
|
3305
|
+
"Orchestrator": orchestrator,
|
|
3306
|
+
"NodeRecovery": node_recovery,
|
|
3299
3307
|
}
|
|
3300
3308
|
|
|
3301
3309
|
operation_input_args = Base.populate_chained_attributes(
|
|
@@ -3406,6 +3414,7 @@ class Cluster(Base):
|
|
|
3406
3414
|
def update(
|
|
3407
3415
|
self,
|
|
3408
3416
|
instance_groups: List[ClusterInstanceGroupSpecification],
|
|
3417
|
+
node_recovery: Optional[str] = Unassigned(),
|
|
3409
3418
|
) -> Optional["Cluster"]:
|
|
3410
3419
|
"""
|
|
3411
3420
|
Update a Cluster resource
|
|
@@ -3434,6 +3443,7 @@ class Cluster(Base):
|
|
|
3434
3443
|
operation_input_args = {
|
|
3435
3444
|
"ClusterName": self.cluster_name,
|
|
3436
3445
|
"InstanceGroups": instance_groups,
|
|
3446
|
+
"NodeRecovery": node_recovery,
|
|
3437
3447
|
}
|
|
3438
3448
|
logger.debug(f"Input request: {operation_input_args}")
|
|
3439
3449
|
# serialize the input request
|
|
@@ -8095,6 +8105,125 @@ class Endpoint(Base):
|
|
|
8095
8105
|
raise e
|
|
8096
8106
|
time.sleep(poll)
|
|
8097
8107
|
|
|
8108
|
+
@classmethod
|
|
8109
|
+
@Base.add_validate_call
|
|
8110
|
+
def get_all(
|
|
8111
|
+
cls,
|
|
8112
|
+
sort_by: Optional[str] = Unassigned(),
|
|
8113
|
+
sort_order: Optional[str] = Unassigned(),
|
|
8114
|
+
name_contains: Optional[str] = Unassigned(),
|
|
8115
|
+
creation_time_before: Optional[datetime.datetime] = Unassigned(),
|
|
8116
|
+
creation_time_after: Optional[datetime.datetime] = Unassigned(),
|
|
8117
|
+
last_modified_time_before: Optional[datetime.datetime] = Unassigned(),
|
|
8118
|
+
last_modified_time_after: Optional[datetime.datetime] = Unassigned(),
|
|
8119
|
+
status_equals: Optional[str] = Unassigned(),
|
|
8120
|
+
session: Optional[Session] = None,
|
|
8121
|
+
region: Optional[str] = None,
|
|
8122
|
+
) -> ResourceIterator["Endpoint"]:
|
|
8123
|
+
"""
|
|
8124
|
+
Get all Endpoint resources
|
|
8125
|
+
|
|
8126
|
+
Parameters:
|
|
8127
|
+
sort_by: Sorts the list of results. The default is CreationTime.
|
|
8128
|
+
sort_order: The sort order for results. The default is Descending.
|
|
8129
|
+
next_token: If the result of a ListEndpoints request was truncated, the response includes a NextToken. To retrieve the next set of endpoints, use the token in the next request.
|
|
8130
|
+
max_results: The maximum number of endpoints to return in the response. This value defaults to 10.
|
|
8131
|
+
name_contains: A string in endpoint names. This filter returns only endpoints whose name contains the specified string.
|
|
8132
|
+
creation_time_before: A filter that returns only endpoints that were created before the specified time (timestamp).
|
|
8133
|
+
creation_time_after: A filter that returns only endpoints with a creation time greater than or equal to the specified time (timestamp).
|
|
8134
|
+
last_modified_time_before: A filter that returns only endpoints that were modified before the specified timestamp.
|
|
8135
|
+
last_modified_time_after: A filter that returns only endpoints that were modified after the specified timestamp.
|
|
8136
|
+
status_equals: A filter that returns only endpoints with the specified status.
|
|
8137
|
+
session: Boto3 session.
|
|
8138
|
+
region: Region name.
|
|
8139
|
+
|
|
8140
|
+
Returns:
|
|
8141
|
+
Iterator for listed Endpoint resources.
|
|
8142
|
+
|
|
8143
|
+
Raises:
|
|
8144
|
+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
8145
|
+
The error message and error code can be parsed from the exception as follows:
|
|
8146
|
+
```
|
|
8147
|
+
try:
|
|
8148
|
+
# AWS service call here
|
|
8149
|
+
except botocore.exceptions.ClientError as e:
|
|
8150
|
+
error_message = e.response['Error']['Message']
|
|
8151
|
+
error_code = e.response['Error']['Code']
|
|
8152
|
+
```
|
|
8153
|
+
"""
|
|
8154
|
+
|
|
8155
|
+
client = Base.get_sagemaker_client(
|
|
8156
|
+
session=session, region_name=region, service_name="sagemaker"
|
|
8157
|
+
)
|
|
8158
|
+
|
|
8159
|
+
operation_input_args = {
|
|
8160
|
+
"SortBy": sort_by,
|
|
8161
|
+
"SortOrder": sort_order,
|
|
8162
|
+
"NameContains": name_contains,
|
|
8163
|
+
"CreationTimeBefore": creation_time_before,
|
|
8164
|
+
"CreationTimeAfter": creation_time_after,
|
|
8165
|
+
"LastModifiedTimeBefore": last_modified_time_before,
|
|
8166
|
+
"LastModifiedTimeAfter": last_modified_time_after,
|
|
8167
|
+
"StatusEquals": status_equals,
|
|
8168
|
+
}
|
|
8169
|
+
|
|
8170
|
+
# serialize the input request
|
|
8171
|
+
operation_input_args = serialize(operation_input_args)
|
|
8172
|
+
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
8173
|
+
|
|
8174
|
+
return ResourceIterator(
|
|
8175
|
+
client=client,
|
|
8176
|
+
list_method="list_endpoints",
|
|
8177
|
+
summaries_key="Endpoints",
|
|
8178
|
+
summary_name="EndpointSummary",
|
|
8179
|
+
resource_cls=Endpoint,
|
|
8180
|
+
list_method_kwargs=operation_input_args,
|
|
8181
|
+
)
|
|
8182
|
+
|
|
8183
|
+
@Base.add_validate_call
|
|
8184
|
+
def update_weights_and_capacities(
|
|
8185
|
+
self,
|
|
8186
|
+
desired_weights_and_capacities: List[DesiredWeightAndCapacity],
|
|
8187
|
+
session: Optional[Session] = None,
|
|
8188
|
+
region: Optional[str] = None,
|
|
8189
|
+
) -> None:
|
|
8190
|
+
"""
|
|
8191
|
+
Updates variant weight of one or more variants associated with an existing endpoint, or capacity of one variant associated with an existing endpoint.
|
|
8192
|
+
|
|
8193
|
+
Parameters:
|
|
8194
|
+
desired_weights_and_capacities: An object that provides new capacity and weight values for a variant.
|
|
8195
|
+
session: Boto3 session.
|
|
8196
|
+
region: Region name.
|
|
8197
|
+
|
|
8198
|
+
Raises:
|
|
8199
|
+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
8200
|
+
The error message and error code can be parsed from the exception as follows:
|
|
8201
|
+
```
|
|
8202
|
+
try:
|
|
8203
|
+
# AWS service call here
|
|
8204
|
+
except botocore.exceptions.ClientError as e:
|
|
8205
|
+
error_message = e.response['Error']['Message']
|
|
8206
|
+
error_code = e.response['Error']['Code']
|
|
8207
|
+
```
|
|
8208
|
+
ResourceLimitExceeded: You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.
|
|
8209
|
+
"""
|
|
8210
|
+
|
|
8211
|
+
operation_input_args = {
|
|
8212
|
+
"EndpointName": self.endpoint_name,
|
|
8213
|
+
"DesiredWeightsAndCapacities": desired_weights_and_capacities,
|
|
8214
|
+
}
|
|
8215
|
+
# serialize the input request
|
|
8216
|
+
operation_input_args = serialize(operation_input_args)
|
|
8217
|
+
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
8218
|
+
|
|
8219
|
+
client = Base.get_sagemaker_client(
|
|
8220
|
+
session=session, region_name=region, service_name="sagemaker"
|
|
8221
|
+
)
|
|
8222
|
+
|
|
8223
|
+
logger.debug(f"Calling update_endpoint_weights_and_capacities API")
|
|
8224
|
+
response = client.update_endpoint_weights_and_capacities(**operation_input_args)
|
|
8225
|
+
logger.debug(f"Response: {response}")
|
|
8226
|
+
|
|
8098
8227
|
@Base.add_validate_call
|
|
8099
8228
|
def invoke(
|
|
8100
8229
|
self,
|
|
@@ -8108,9 +8237,12 @@ class Endpoint(Base):
|
|
|
8108
8237
|
inference_id: Optional[str] = Unassigned(),
|
|
8109
8238
|
enable_explanations: Optional[str] = Unassigned(),
|
|
8110
8239
|
inference_component_name: Optional[str] = Unassigned(),
|
|
8111
|
-
|
|
8240
|
+
session_id: Optional[str] = Unassigned(),
|
|
8241
|
+
session: Optional[Session] = None,
|
|
8242
|
+
region: Optional[str] = None,
|
|
8243
|
+
) -> Optional[InvokeEndpointOutput]:
|
|
8112
8244
|
"""
|
|
8113
|
-
|
|
8245
|
+
After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint.
|
|
8114
8246
|
|
|
8115
8247
|
Parameters:
|
|
8116
8248
|
body: Provides input data, in the format specified in the ContentType request header. Amazon SageMaker passes all of the data in the body to the model. For information about the format of the request body, see Common Data Formats-Inference.
|
|
@@ -8123,9 +8255,12 @@ class Endpoint(Base):
|
|
|
8123
8255
|
inference_id: If you provide a value, it is added to the captured data when you enable data capture on the endpoint. For information about data capture, see Capture Data.
|
|
8124
8256
|
enable_explanations: An optional JMESPath expression used to override the EnableExplanations parameter of the ClarifyExplainerConfig API. See the EnableExplanations section in the developer guide for more information.
|
|
8125
8257
|
inference_component_name: If the endpoint hosts one or more inference components, this parameter specifies the name of inference component to invoke.
|
|
8258
|
+
session_id: Creates a stateful session or identifies an existing one. You can do one of the following: Create a stateful session by specifying the value NEW_SESSION. Send your request to an existing stateful session by specifying the ID of that session. With a stateful session, you can send multiple requests to a stateful model. When you create a session with a stateful model, the model must create the session ID and set the expiration time. The model must also provide that information in the response to your request. You can get the ID and timestamp from the NewSessionId response parameter. For any subsequent request where you specify that session ID, SageMaker routes the request to the same instance that supports the session.
|
|
8259
|
+
session: Boto3 session.
|
|
8260
|
+
region: Region name.
|
|
8126
8261
|
|
|
8127
8262
|
Returns:
|
|
8128
|
-
|
|
8263
|
+
InvokeEndpointOutput
|
|
8129
8264
|
|
|
8130
8265
|
Raises:
|
|
8131
8266
|
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
@@ -8138,15 +8273,13 @@ class Endpoint(Base):
|
|
|
8138
8273
|
error_code = e.response['Error']['Code']
|
|
8139
8274
|
```
|
|
8140
8275
|
InternalDependencyException: Your request caused an exception with an internal dependency. Contact customer support.
|
|
8141
|
-
InternalFailure: An internal failure occurred.
|
|
8276
|
+
InternalFailure: An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.
|
|
8142
8277
|
ModelError: Model (owned by the customer in the container) returned 4xx or 5xx error code.
|
|
8143
8278
|
ModelNotReadyException: Either a serverless endpoint variant's resources are still being provisioned, or a multi-model endpoint is still downloading or loading the target model. Wait and try your request again.
|
|
8144
|
-
ServiceUnavailable: The service is unavailable.
|
|
8145
|
-
ValidationError:
|
|
8279
|
+
ServiceUnavailable: The service is currently unavailable.
|
|
8280
|
+
ValidationError: There was an error validating your request.
|
|
8146
8281
|
"""
|
|
8147
8282
|
|
|
8148
|
-
logger.info(f"Invoking endpoint resource.")
|
|
8149
|
-
client = SageMakerRuntimeClient(service_name="sagemaker-runtime").client
|
|
8150
8283
|
operation_input_args = {
|
|
8151
8284
|
"EndpointName": self.endpoint_name,
|
|
8152
8285
|
"Body": body,
|
|
@@ -8159,17 +8292,22 @@ class Endpoint(Base):
|
|
|
8159
8292
|
"InferenceId": inference_id,
|
|
8160
8293
|
"EnableExplanations": enable_explanations,
|
|
8161
8294
|
"InferenceComponentName": inference_component_name,
|
|
8295
|
+
"SessionId": session_id,
|
|
8162
8296
|
}
|
|
8163
|
-
logger.debug(f"Input request: {operation_input_args}")
|
|
8164
8297
|
# serialize the input request
|
|
8165
8298
|
operation_input_args = serialize(operation_input_args)
|
|
8166
8299
|
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
8167
8300
|
|
|
8168
|
-
|
|
8301
|
+
client = Base.get_sagemaker_client(
|
|
8302
|
+
session=session, region_name=region, service_name="sagemaker-runtime"
|
|
8303
|
+
)
|
|
8304
|
+
|
|
8305
|
+
logger.debug(f"Calling invoke_endpoint API")
|
|
8169
8306
|
response = client.invoke_endpoint(**operation_input_args)
|
|
8170
8307
|
logger.debug(f"Response: {response}")
|
|
8171
8308
|
|
|
8172
|
-
|
|
8309
|
+
transformed_response = transform(response, "InvokeEndpointOutput")
|
|
8310
|
+
return InvokeEndpointOutput(**transformed_response)
|
|
8173
8311
|
|
|
8174
8312
|
@Base.add_validate_call
|
|
8175
8313
|
def invoke_async(
|
|
@@ -8181,9 +8319,11 @@ class Endpoint(Base):
|
|
|
8181
8319
|
inference_id: Optional[str] = Unassigned(),
|
|
8182
8320
|
request_ttl_seconds: Optional[int] = Unassigned(),
|
|
8183
8321
|
invocation_timeout_seconds: Optional[int] = Unassigned(),
|
|
8184
|
-
|
|
8322
|
+
session: Optional[Session] = None,
|
|
8323
|
+
region: Optional[str] = None,
|
|
8324
|
+
) -> Optional[InvokeEndpointAsyncOutput]:
|
|
8185
8325
|
"""
|
|
8186
|
-
|
|
8326
|
+
After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint in an asynchronous manner.
|
|
8187
8327
|
|
|
8188
8328
|
Parameters:
|
|
8189
8329
|
input_location: The Amazon S3 URI where the inference request payload is stored.
|
|
@@ -8193,9 +8333,11 @@ class Endpoint(Base):
|
|
|
8193
8333
|
inference_id: The identifier for the inference request. Amazon SageMaker will generate an identifier for you if none is specified.
|
|
8194
8334
|
request_ttl_seconds: Maximum age in seconds a request can be in the queue before it is marked as expired. The default is 6 hours, or 21,600 seconds.
|
|
8195
8335
|
invocation_timeout_seconds: Maximum amount of time in seconds a request can be processed before it is marked as expired. The default is 15 minutes, or 900 seconds.
|
|
8336
|
+
session: Boto3 session.
|
|
8337
|
+
region: Region name.
|
|
8196
8338
|
|
|
8197
8339
|
Returns:
|
|
8198
|
-
|
|
8340
|
+
InvokeEndpointAsyncOutput
|
|
8199
8341
|
|
|
8200
8342
|
Raises:
|
|
8201
8343
|
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
@@ -8207,14 +8349,11 @@ class Endpoint(Base):
|
|
|
8207
8349
|
error_message = e.response['Error']['Message']
|
|
8208
8350
|
error_code = e.response['Error']['Code']
|
|
8209
8351
|
```
|
|
8210
|
-
InternalFailure: An internal failure occurred.
|
|
8211
|
-
ServiceUnavailable: The service is unavailable.
|
|
8212
|
-
ValidationError:
|
|
8352
|
+
InternalFailure: An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.
|
|
8353
|
+
ServiceUnavailable: The service is currently unavailable.
|
|
8354
|
+
ValidationError: There was an error validating your request.
|
|
8213
8355
|
"""
|
|
8214
8356
|
|
|
8215
|
-
logger.info(f"Invoking endpoint resource Async.")
|
|
8216
|
-
client = SageMakerRuntimeClient(service_name="sagemaker-runtime").client
|
|
8217
|
-
|
|
8218
8357
|
operation_input_args = {
|
|
8219
8358
|
"EndpointName": self.endpoint_name,
|
|
8220
8359
|
"ContentType": content_type,
|
|
@@ -8225,16 +8364,20 @@ class Endpoint(Base):
|
|
|
8225
8364
|
"RequestTTLSeconds": request_ttl_seconds,
|
|
8226
8365
|
"InvocationTimeoutSeconds": invocation_timeout_seconds,
|
|
8227
8366
|
}
|
|
8228
|
-
logger.debug(f"Input request: {operation_input_args}")
|
|
8229
8367
|
# serialize the input request
|
|
8230
8368
|
operation_input_args = serialize(operation_input_args)
|
|
8231
8369
|
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
8232
8370
|
|
|
8233
|
-
|
|
8371
|
+
client = Base.get_sagemaker_client(
|
|
8372
|
+
session=session, region_name=region, service_name="sagemaker-runtime"
|
|
8373
|
+
)
|
|
8374
|
+
|
|
8375
|
+
logger.debug(f"Calling invoke_endpoint_async API")
|
|
8234
8376
|
response = client.invoke_endpoint_async(**operation_input_args)
|
|
8235
8377
|
logger.debug(f"Response: {response}")
|
|
8236
8378
|
|
|
8237
|
-
|
|
8379
|
+
transformed_response = transform(response, "InvokeEndpointAsyncOutput")
|
|
8380
|
+
return InvokeEndpointAsyncOutput(**transformed_response)
|
|
8238
8381
|
|
|
8239
8382
|
@Base.add_validate_call
|
|
8240
8383
|
def invoke_with_response_stream(
|
|
@@ -8247,9 +8390,12 @@ class Endpoint(Base):
|
|
|
8247
8390
|
target_container_hostname: Optional[str] = Unassigned(),
|
|
8248
8391
|
inference_id: Optional[str] = Unassigned(),
|
|
8249
8392
|
inference_component_name: Optional[str] = Unassigned(),
|
|
8250
|
-
|
|
8393
|
+
session_id: Optional[str] = Unassigned(),
|
|
8394
|
+
session: Optional[Session] = None,
|
|
8395
|
+
region: Optional[str] = None,
|
|
8396
|
+
) -> Optional[InvokeEndpointWithResponseStreamOutput]:
|
|
8251
8397
|
"""
|
|
8252
|
-
|
|
8398
|
+
Invokes a model at the specified endpoint to return the inference response as a stream.
|
|
8253
8399
|
|
|
8254
8400
|
Parameters:
|
|
8255
8401
|
body: Provides input data, in the format specified in the ContentType request header. Amazon SageMaker passes all of the data in the body to the model. For information about the format of the request body, see Common Data Formats-Inference.
|
|
@@ -8260,9 +8406,12 @@ class Endpoint(Base):
|
|
|
8260
8406
|
target_container_hostname: If the endpoint hosts multiple containers and is configured to use direct invocation, this parameter specifies the host name of the container to invoke.
|
|
8261
8407
|
inference_id: An identifier that you assign to your request.
|
|
8262
8408
|
inference_component_name: If the endpoint hosts one or more inference components, this parameter specifies the name of inference component to invoke for a streaming response.
|
|
8409
|
+
session_id: The ID of a stateful session to handle your request. You can't create a stateful session by using the InvokeEndpointWithResponseStream action. Instead, you can create one by using the InvokeEndpoint action. In your request, you specify NEW_SESSION for the SessionId request parameter. The response to that request provides the session ID for the NewSessionId response parameter.
|
|
8410
|
+
session: Boto3 session.
|
|
8411
|
+
region: Region name.
|
|
8263
8412
|
|
|
8264
8413
|
Returns:
|
|
8265
|
-
|
|
8414
|
+
InvokeEndpointWithResponseStreamOutput
|
|
8266
8415
|
|
|
8267
8416
|
Raises:
|
|
8268
8417
|
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
@@ -8274,17 +8423,14 @@ class Endpoint(Base):
|
|
|
8274
8423
|
error_message = e.response['Error']['Message']
|
|
8275
8424
|
error_code = e.response['Error']['Code']
|
|
8276
8425
|
```
|
|
8277
|
-
InternalFailure: An internal failure occurred.
|
|
8426
|
+
InternalFailure: An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.
|
|
8278
8427
|
InternalStreamFailure: The stream processing failed because of an unknown error, exception or failure. Try your request again.
|
|
8279
8428
|
ModelError: Model (owned by the customer in the container) returned 4xx or 5xx error code.
|
|
8280
8429
|
ModelStreamError: An error occurred while streaming the response body. This error can have the following error codes: ModelInvocationTimeExceeded The model failed to finish sending the response within the timeout period allowed by Amazon SageMaker. StreamBroken The Transmission Control Protocol (TCP) connection between the client and the model was reset or closed.
|
|
8281
|
-
ServiceUnavailable: The service is unavailable.
|
|
8282
|
-
ValidationError:
|
|
8430
|
+
ServiceUnavailable: The service is currently unavailable.
|
|
8431
|
+
ValidationError: There was an error validating your request.
|
|
8283
8432
|
"""
|
|
8284
8433
|
|
|
8285
|
-
logger.info(f"Invoking endpoint resource with Response Stream.")
|
|
8286
|
-
client = SageMakerRuntimeClient(service_name="sagemaker-runtime").client
|
|
8287
|
-
|
|
8288
8434
|
operation_input_args = {
|
|
8289
8435
|
"EndpointName": self.endpoint_name,
|
|
8290
8436
|
"Body": body,
|
|
@@ -8295,137 +8441,23 @@ class Endpoint(Base):
|
|
|
8295
8441
|
"TargetContainerHostname": target_container_hostname,
|
|
8296
8442
|
"InferenceId": inference_id,
|
|
8297
8443
|
"InferenceComponentName": inference_component_name,
|
|
8298
|
-
|
|
8299
|
-
logger.debug(f"Input request: {operation_input_args}")
|
|
8300
|
-
# serialize the input request
|
|
8301
|
-
operation_input_args = serialize(operation_input_args)
|
|
8302
|
-
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
8303
|
-
|
|
8304
|
-
# create the resource
|
|
8305
|
-
response = client.invoke_endpoint_with_response_stream(**operation_input_args)
|
|
8306
|
-
logger.debug(f"Response: {response}")
|
|
8307
|
-
|
|
8308
|
-
return response
|
|
8309
|
-
|
|
8310
|
-
@classmethod
|
|
8311
|
-
@Base.add_validate_call
|
|
8312
|
-
def get_all(
|
|
8313
|
-
cls,
|
|
8314
|
-
sort_by: Optional[str] = Unassigned(),
|
|
8315
|
-
sort_order: Optional[str] = Unassigned(),
|
|
8316
|
-
name_contains: Optional[str] = Unassigned(),
|
|
8317
|
-
creation_time_before: Optional[datetime.datetime] = Unassigned(),
|
|
8318
|
-
creation_time_after: Optional[datetime.datetime] = Unassigned(),
|
|
8319
|
-
last_modified_time_before: Optional[datetime.datetime] = Unassigned(),
|
|
8320
|
-
last_modified_time_after: Optional[datetime.datetime] = Unassigned(),
|
|
8321
|
-
status_equals: Optional[str] = Unassigned(),
|
|
8322
|
-
session: Optional[Session] = None,
|
|
8323
|
-
region: Optional[str] = None,
|
|
8324
|
-
) -> ResourceIterator["Endpoint"]:
|
|
8325
|
-
"""
|
|
8326
|
-
Get all Endpoint resources
|
|
8327
|
-
|
|
8328
|
-
Parameters:
|
|
8329
|
-
sort_by: Sorts the list of results. The default is CreationTime.
|
|
8330
|
-
sort_order: The sort order for results. The default is Descending.
|
|
8331
|
-
next_token: If the result of a ListEndpoints request was truncated, the response includes a NextToken. To retrieve the next set of endpoints, use the token in the next request.
|
|
8332
|
-
max_results: The maximum number of endpoints to return in the response. This value defaults to 10.
|
|
8333
|
-
name_contains: A string in endpoint names. This filter returns only endpoints whose name contains the specified string.
|
|
8334
|
-
creation_time_before: A filter that returns only endpoints that were created before the specified time (timestamp).
|
|
8335
|
-
creation_time_after: A filter that returns only endpoints with a creation time greater than or equal to the specified time (timestamp).
|
|
8336
|
-
last_modified_time_before: A filter that returns only endpoints that were modified before the specified timestamp.
|
|
8337
|
-
last_modified_time_after: A filter that returns only endpoints that were modified after the specified timestamp.
|
|
8338
|
-
status_equals: A filter that returns only endpoints with the specified status.
|
|
8339
|
-
session: Boto3 session.
|
|
8340
|
-
region: Region name.
|
|
8341
|
-
|
|
8342
|
-
Returns:
|
|
8343
|
-
Iterator for listed Endpoint resources.
|
|
8344
|
-
|
|
8345
|
-
Raises:
|
|
8346
|
-
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
8347
|
-
The error message and error code can be parsed from the exception as follows:
|
|
8348
|
-
```
|
|
8349
|
-
try:
|
|
8350
|
-
# AWS service call here
|
|
8351
|
-
except botocore.exceptions.ClientError as e:
|
|
8352
|
-
error_message = e.response['Error']['Message']
|
|
8353
|
-
error_code = e.response['Error']['Code']
|
|
8354
|
-
```
|
|
8355
|
-
"""
|
|
8356
|
-
|
|
8357
|
-
client = Base.get_sagemaker_client(
|
|
8358
|
-
session=session, region_name=region, service_name="sagemaker"
|
|
8359
|
-
)
|
|
8360
|
-
|
|
8361
|
-
operation_input_args = {
|
|
8362
|
-
"SortBy": sort_by,
|
|
8363
|
-
"SortOrder": sort_order,
|
|
8364
|
-
"NameContains": name_contains,
|
|
8365
|
-
"CreationTimeBefore": creation_time_before,
|
|
8366
|
-
"CreationTimeAfter": creation_time_after,
|
|
8367
|
-
"LastModifiedTimeBefore": last_modified_time_before,
|
|
8368
|
-
"LastModifiedTimeAfter": last_modified_time_after,
|
|
8369
|
-
"StatusEquals": status_equals,
|
|
8370
|
-
}
|
|
8371
|
-
|
|
8372
|
-
# serialize the input request
|
|
8373
|
-
operation_input_args = serialize(operation_input_args)
|
|
8374
|
-
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
8375
|
-
|
|
8376
|
-
return ResourceIterator(
|
|
8377
|
-
client=client,
|
|
8378
|
-
list_method="list_endpoints",
|
|
8379
|
-
summaries_key="Endpoints",
|
|
8380
|
-
summary_name="EndpointSummary",
|
|
8381
|
-
resource_cls=Endpoint,
|
|
8382
|
-
list_method_kwargs=operation_input_args,
|
|
8383
|
-
)
|
|
8384
|
-
|
|
8385
|
-
@Base.add_validate_call
|
|
8386
|
-
def update_weights_and_capacities(
|
|
8387
|
-
self,
|
|
8388
|
-
desired_weights_and_capacities: List[DesiredWeightAndCapacity],
|
|
8389
|
-
session: Optional[Session] = None,
|
|
8390
|
-
region: Optional[str] = None,
|
|
8391
|
-
) -> None:
|
|
8392
|
-
"""
|
|
8393
|
-
Updates variant weight of one or more variants associated with an existing endpoint, or capacity of one variant associated with an existing endpoint.
|
|
8394
|
-
|
|
8395
|
-
Parameters:
|
|
8396
|
-
desired_weights_and_capacities: An object that provides new capacity and weight values for a variant.
|
|
8397
|
-
session: Boto3 session.
|
|
8398
|
-
region: Region name.
|
|
8399
|
-
|
|
8400
|
-
Raises:
|
|
8401
|
-
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
8402
|
-
The error message and error code can be parsed from the exception as follows:
|
|
8403
|
-
```
|
|
8404
|
-
try:
|
|
8405
|
-
# AWS service call here
|
|
8406
|
-
except botocore.exceptions.ClientError as e:
|
|
8407
|
-
error_message = e.response['Error']['Message']
|
|
8408
|
-
error_code = e.response['Error']['Code']
|
|
8409
|
-
```
|
|
8410
|
-
ResourceLimitExceeded: You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.
|
|
8411
|
-
"""
|
|
8412
|
-
|
|
8413
|
-
operation_input_args = {
|
|
8414
|
-
"EndpointName": self.endpoint_name,
|
|
8415
|
-
"DesiredWeightsAndCapacities": desired_weights_and_capacities,
|
|
8444
|
+
"SessionId": session_id,
|
|
8416
8445
|
}
|
|
8417
8446
|
# serialize the input request
|
|
8418
8447
|
operation_input_args = serialize(operation_input_args)
|
|
8419
8448
|
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
8420
8449
|
|
|
8421
8450
|
client = Base.get_sagemaker_client(
|
|
8422
|
-
session=session, region_name=region, service_name="sagemaker"
|
|
8451
|
+
session=session, region_name=region, service_name="sagemaker-runtime"
|
|
8423
8452
|
)
|
|
8424
8453
|
|
|
8425
|
-
logger.debug(f"Calling
|
|
8426
|
-
response = client.
|
|
8454
|
+
logger.debug(f"Calling invoke_endpoint_with_response_stream API")
|
|
8455
|
+
response = client.invoke_endpoint_with_response_stream(**operation_input_args)
|
|
8427
8456
|
logger.debug(f"Response: {response}")
|
|
8428
8457
|
|
|
8458
|
+
transformed_response = transform(response, "InvokeEndpointWithResponseStreamOutput")
|
|
8459
|
+
return InvokeEndpointWithResponseStreamOutput(**transformed_response)
|
|
8460
|
+
|
|
8429
8461
|
|
|
8430
8462
|
class EndpointConfig(Base):
|
|
8431
8463
|
"""
|
|
@@ -9665,6 +9697,230 @@ class FeatureGroup(Base):
|
|
|
9665
9697
|
list_method_kwargs=operation_input_args,
|
|
9666
9698
|
)
|
|
9667
9699
|
|
|
9700
|
+
@Base.add_validate_call
|
|
9701
|
+
def get_record(
|
|
9702
|
+
self,
|
|
9703
|
+
record_identifier_value_as_string: str,
|
|
9704
|
+
feature_names: Optional[List[str]] = Unassigned(),
|
|
9705
|
+
expiration_time_response: Optional[str] = Unassigned(),
|
|
9706
|
+
session: Optional[Session] = None,
|
|
9707
|
+
region: Optional[str] = None,
|
|
9708
|
+
) -> Optional[GetRecordResponse]:
|
|
9709
|
+
"""
|
|
9710
|
+
Use for OnlineStore serving from a FeatureStore.
|
|
9711
|
+
|
|
9712
|
+
Parameters:
|
|
9713
|
+
record_identifier_value_as_string: The value that corresponds to RecordIdentifier type and uniquely identifies the record in the FeatureGroup.
|
|
9714
|
+
feature_names: List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.
|
|
9715
|
+
expiration_time_response: Parameter to request ExpiresAt in response. If Enabled, GetRecord will return the value of ExpiresAt, if it is not null. If Disabled and null, GetRecord will return null.
|
|
9716
|
+
session: Boto3 session.
|
|
9717
|
+
region: Region name.
|
|
9718
|
+
|
|
9719
|
+
Returns:
|
|
9720
|
+
GetRecordResponse
|
|
9721
|
+
|
|
9722
|
+
Raises:
|
|
9723
|
+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
9724
|
+
The error message and error code can be parsed from the exception as follows:
|
|
9725
|
+
```
|
|
9726
|
+
try:
|
|
9727
|
+
# AWS service call here
|
|
9728
|
+
except botocore.exceptions.ClientError as e:
|
|
9729
|
+
error_message = e.response['Error']['Message']
|
|
9730
|
+
error_code = e.response['Error']['Code']
|
|
9731
|
+
```
|
|
9732
|
+
AccessForbidden: You do not have permission to perform an action.
|
|
9733
|
+
InternalFailure: An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.
|
|
9734
|
+
ResourceNotFound: Resource being access is not found.
|
|
9735
|
+
ServiceUnavailable: The service is currently unavailable.
|
|
9736
|
+
ValidationError: There was an error validating your request.
|
|
9737
|
+
"""
|
|
9738
|
+
|
|
9739
|
+
operation_input_args = {
|
|
9740
|
+
"FeatureGroupName": self.feature_group_name,
|
|
9741
|
+
"RecordIdentifierValueAsString": record_identifier_value_as_string,
|
|
9742
|
+
"FeatureNames": feature_names,
|
|
9743
|
+
"ExpirationTimeResponse": expiration_time_response,
|
|
9744
|
+
}
|
|
9745
|
+
# serialize the input request
|
|
9746
|
+
operation_input_args = serialize(operation_input_args)
|
|
9747
|
+
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
9748
|
+
|
|
9749
|
+
client = Base.get_sagemaker_client(
|
|
9750
|
+
session=session, region_name=region, service_name="sagemaker-featurestore-runtime"
|
|
9751
|
+
)
|
|
9752
|
+
|
|
9753
|
+
logger.debug(f"Calling get_record API")
|
|
9754
|
+
response = client.get_record(**operation_input_args)
|
|
9755
|
+
logger.debug(f"Response: {response}")
|
|
9756
|
+
|
|
9757
|
+
transformed_response = transform(response, "GetRecordResponse")
|
|
9758
|
+
return GetRecordResponse(**transformed_response)
|
|
9759
|
+
|
|
9760
|
+
@Base.add_validate_call
|
|
9761
|
+
def put_record(
|
|
9762
|
+
self,
|
|
9763
|
+
record: List[FeatureValue],
|
|
9764
|
+
target_stores: Optional[List[str]] = Unassigned(),
|
|
9765
|
+
ttl_duration: Optional[TtlDuration] = Unassigned(),
|
|
9766
|
+
session: Optional[Session] = None,
|
|
9767
|
+
region: Optional[str] = None,
|
|
9768
|
+
) -> None:
|
|
9769
|
+
"""
|
|
9770
|
+
The PutRecord API is used to ingest a list of Records into your feature group.
|
|
9771
|
+
|
|
9772
|
+
Parameters:
|
|
9773
|
+
record: List of FeatureValues to be inserted. This will be a full over-write. If you only want to update few of the feature values, do the following: Use GetRecord to retrieve the latest record. Update the record returned from GetRecord. Use PutRecord to update feature values.
|
|
9774
|
+
target_stores: A list of stores to which you're adding the record. By default, Feature Store adds the record to all of the stores that you're using for the FeatureGroup.
|
|
9775
|
+
ttl_duration: Time to live duration, where the record is hard deleted after the expiration time is reached; ExpiresAt = EventTime + TtlDuration. For information on HardDelete, see the DeleteRecord API in the Amazon SageMaker API Reference guide.
|
|
9776
|
+
session: Boto3 session.
|
|
9777
|
+
region: Region name.
|
|
9778
|
+
|
|
9779
|
+
Raises:
|
|
9780
|
+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
9781
|
+
The error message and error code can be parsed from the exception as follows:
|
|
9782
|
+
```
|
|
9783
|
+
try:
|
|
9784
|
+
# AWS service call here
|
|
9785
|
+
except botocore.exceptions.ClientError as e:
|
|
9786
|
+
error_message = e.response['Error']['Message']
|
|
9787
|
+
error_code = e.response['Error']['Code']
|
|
9788
|
+
```
|
|
9789
|
+
AccessForbidden: You do not have permission to perform an action.
|
|
9790
|
+
InternalFailure: An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.
|
|
9791
|
+
ServiceUnavailable: The service is currently unavailable.
|
|
9792
|
+
ValidationError: There was an error validating your request.
|
|
9793
|
+
"""
|
|
9794
|
+
|
|
9795
|
+
operation_input_args = {
|
|
9796
|
+
"FeatureGroupName": self.feature_group_name,
|
|
9797
|
+
"Record": record,
|
|
9798
|
+
"TargetStores": target_stores,
|
|
9799
|
+
"TtlDuration": ttl_duration,
|
|
9800
|
+
}
|
|
9801
|
+
# serialize the input request
|
|
9802
|
+
operation_input_args = serialize(operation_input_args)
|
|
9803
|
+
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
9804
|
+
|
|
9805
|
+
client = Base.get_sagemaker_client(
|
|
9806
|
+
session=session, region_name=region, service_name="sagemaker-featurestore-runtime"
|
|
9807
|
+
)
|
|
9808
|
+
|
|
9809
|
+
logger.debug(f"Calling put_record API")
|
|
9810
|
+
response = client.put_record(**operation_input_args)
|
|
9811
|
+
logger.debug(f"Response: {response}")
|
|
9812
|
+
|
|
9813
|
+
@Base.add_validate_call
|
|
9814
|
+
def delete_record(
|
|
9815
|
+
self,
|
|
9816
|
+
record_identifier_value_as_string: str,
|
|
9817
|
+
event_time: str,
|
|
9818
|
+
target_stores: Optional[List[str]] = Unassigned(),
|
|
9819
|
+
deletion_mode: Optional[str] = Unassigned(),
|
|
9820
|
+
session: Optional[Session] = None,
|
|
9821
|
+
region: Optional[str] = None,
|
|
9822
|
+
) -> None:
|
|
9823
|
+
"""
|
|
9824
|
+
Deletes a Record from a FeatureGroup in the OnlineStore.
|
|
9825
|
+
|
|
9826
|
+
Parameters:
|
|
9827
|
+
record_identifier_value_as_string: The value for the RecordIdentifier that uniquely identifies the record, in string format.
|
|
9828
|
+
event_time: Timestamp indicating when the deletion event occurred. EventTime can be used to query data at a certain point in time.
|
|
9829
|
+
target_stores: A list of stores from which you're deleting the record. By default, Feature Store deletes the record from all of the stores that you're using for the FeatureGroup.
|
|
9830
|
+
deletion_mode: The name of the deletion mode for deleting the record. By default, the deletion mode is set to SoftDelete.
|
|
9831
|
+
session: Boto3 session.
|
|
9832
|
+
region: Region name.
|
|
9833
|
+
|
|
9834
|
+
Raises:
|
|
9835
|
+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
9836
|
+
The error message and error code can be parsed from the exception as follows:
|
|
9837
|
+
```
|
|
9838
|
+
try:
|
|
9839
|
+
# AWS service call here
|
|
9840
|
+
except botocore.exceptions.ClientError as e:
|
|
9841
|
+
error_message = e.response['Error']['Message']
|
|
9842
|
+
error_code = e.response['Error']['Code']
|
|
9843
|
+
```
|
|
9844
|
+
AccessForbidden: You do not have permission to perform an action.
|
|
9845
|
+
InternalFailure: An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.
|
|
9846
|
+
ServiceUnavailable: The service is currently unavailable.
|
|
9847
|
+
ValidationError: There was an error validating your request.
|
|
9848
|
+
"""
|
|
9849
|
+
|
|
9850
|
+
operation_input_args = {
|
|
9851
|
+
"FeatureGroupName": self.feature_group_name,
|
|
9852
|
+
"RecordIdentifierValueAsString": record_identifier_value_as_string,
|
|
9853
|
+
"EventTime": event_time,
|
|
9854
|
+
"TargetStores": target_stores,
|
|
9855
|
+
"DeletionMode": deletion_mode,
|
|
9856
|
+
}
|
|
9857
|
+
# serialize the input request
|
|
9858
|
+
operation_input_args = serialize(operation_input_args)
|
|
9859
|
+
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
9860
|
+
|
|
9861
|
+
client = Base.get_sagemaker_client(
|
|
9862
|
+
session=session, region_name=region, service_name="sagemaker-featurestore-runtime"
|
|
9863
|
+
)
|
|
9864
|
+
|
|
9865
|
+
logger.debug(f"Calling delete_record API")
|
|
9866
|
+
response = client.delete_record(**operation_input_args)
|
|
9867
|
+
logger.debug(f"Response: {response}")
|
|
9868
|
+
|
|
9869
|
+
@Base.add_validate_call
|
|
9870
|
+
def batch_get_record(
|
|
9871
|
+
self,
|
|
9872
|
+
identifiers: List[BatchGetRecordIdentifier],
|
|
9873
|
+
expiration_time_response: Optional[str] = Unassigned(),
|
|
9874
|
+
session: Optional[Session] = None,
|
|
9875
|
+
region: Optional[str] = None,
|
|
9876
|
+
) -> Optional[BatchGetRecordResponse]:
|
|
9877
|
+
"""
|
|
9878
|
+
Retrieves a batch of Records from a FeatureGroup.
|
|
9879
|
+
|
|
9880
|
+
Parameters:
|
|
9881
|
+
identifiers: A list containing the name or Amazon Resource Name (ARN) of the FeatureGroup, the list of names of Features to be retrieved, and the corresponding RecordIdentifier values as strings.
|
|
9882
|
+
expiration_time_response: Parameter to request ExpiresAt in response. If Enabled, BatchGetRecord will return the value of ExpiresAt, if it is not null. If Disabled and null, BatchGetRecord will return null.
|
|
9883
|
+
session: Boto3 session.
|
|
9884
|
+
region: Region name.
|
|
9885
|
+
|
|
9886
|
+
Returns:
|
|
9887
|
+
BatchGetRecordResponse
|
|
9888
|
+
|
|
9889
|
+
Raises:
|
|
9890
|
+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
9891
|
+
The error message and error code can be parsed from the exception as follows:
|
|
9892
|
+
```
|
|
9893
|
+
try:
|
|
9894
|
+
# AWS service call here
|
|
9895
|
+
except botocore.exceptions.ClientError as e:
|
|
9896
|
+
error_message = e.response['Error']['Message']
|
|
9897
|
+
error_code = e.response['Error']['Code']
|
|
9898
|
+
```
|
|
9899
|
+
AccessForbidden: You do not have permission to perform an action.
|
|
9900
|
+
InternalFailure: An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.
|
|
9901
|
+
ServiceUnavailable: The service is currently unavailable.
|
|
9902
|
+
ValidationError: There was an error validating your request.
|
|
9903
|
+
"""
|
|
9904
|
+
|
|
9905
|
+
operation_input_args = {
|
|
9906
|
+
"Identifiers": identifiers,
|
|
9907
|
+
"ExpirationTimeResponse": expiration_time_response,
|
|
9908
|
+
}
|
|
9909
|
+
# serialize the input request
|
|
9910
|
+
operation_input_args = serialize(operation_input_args)
|
|
9911
|
+
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
9912
|
+
|
|
9913
|
+
client = Base.get_sagemaker_client(
|
|
9914
|
+
session=session, region_name=region, service_name="sagemaker-featurestore-runtime"
|
|
9915
|
+
)
|
|
9916
|
+
|
|
9917
|
+
logger.debug(f"Calling batch_get_record API")
|
|
9918
|
+
response = client.batch_get_record(**operation_input_args)
|
|
9919
|
+
logger.debug(f"Response: {response}")
|
|
9920
|
+
|
|
9921
|
+
transformed_response = transform(response, "BatchGetRecordResponse")
|
|
9922
|
+
return BatchGetRecordResponse(**transformed_response)
|
|
9923
|
+
|
|
9668
9924
|
|
|
9669
9925
|
class FeatureMetadata(Base):
|
|
9670
9926
|
"""
|
|
@@ -27654,6 +27910,49 @@ class TrialComponent(Base):
|
|
|
27654
27910
|
response = client.disassociate_trial_component(**operation_input_args)
|
|
27655
27911
|
logger.debug(f"Response: {response}")
|
|
27656
27912
|
|
|
27913
|
+
@Base.add_validate_call
|
|
27914
|
+
def batch_put_metrics(
|
|
27915
|
+
self,
|
|
27916
|
+
metric_data: List[RawMetricData],
|
|
27917
|
+
session: Optional[Session] = None,
|
|
27918
|
+
region: Optional[str] = None,
|
|
27919
|
+
) -> None:
|
|
27920
|
+
"""
|
|
27921
|
+
Used to ingest training metrics into SageMaker.
|
|
27922
|
+
|
|
27923
|
+
Parameters:
|
|
27924
|
+
metric_data: A list of raw metric values to put.
|
|
27925
|
+
session: Boto3 session.
|
|
27926
|
+
region: Region name.
|
|
27927
|
+
|
|
27928
|
+
Raises:
|
|
27929
|
+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
|
|
27930
|
+
The error message and error code can be parsed from the exception as follows:
|
|
27931
|
+
```
|
|
27932
|
+
try:
|
|
27933
|
+
# AWS service call here
|
|
27934
|
+
except botocore.exceptions.ClientError as e:
|
|
27935
|
+
error_message = e.response['Error']['Message']
|
|
27936
|
+
error_code = e.response['Error']['Code']
|
|
27937
|
+
```
|
|
27938
|
+
"""
|
|
27939
|
+
|
|
27940
|
+
operation_input_args = {
|
|
27941
|
+
"TrialComponentName": self.trial_component_name,
|
|
27942
|
+
"MetricData": metric_data,
|
|
27943
|
+
}
|
|
27944
|
+
# serialize the input request
|
|
27945
|
+
operation_input_args = serialize(operation_input_args)
|
|
27946
|
+
logger.debug(f"Serialized input request: {operation_input_args}")
|
|
27947
|
+
|
|
27948
|
+
client = Base.get_sagemaker_client(
|
|
27949
|
+
session=session, region_name=region, service_name="sagemaker-metrics"
|
|
27950
|
+
)
|
|
27951
|
+
|
|
27952
|
+
logger.debug(f"Calling batch_put_metrics API")
|
|
27953
|
+
response = client.batch_put_metrics(**operation_input_args)
|
|
27954
|
+
logger.debug(f"Response: {response}")
|
|
27955
|
+
|
|
27657
27956
|
|
|
27658
27957
|
class UserProfile(Base):
|
|
27659
27958
|
"""
|