@@ -2778,6 +2778,7 @@ def create_model_package_from_containers(
2778
2778
approval_status = "PendingManualApproval" ,
2779
2779
description = None ,
2780
2780
drift_check_baselines = None ,
2781
+ customer_metadata_properties = customer_metadata_properties ,
2781
2782
):
2782
2783
"""Get request dictionary for CreateModelPackage API.
2783
2784
@@ -2803,6 +2804,9 @@ def create_model_package_from_containers(
2803
2804
or "PendingManualApproval" (default: "PendingManualApproval").
2804
2805
description (str): Model Package description (default: None).
2805
2806
drift_check_baselines (DriftCheckBaselines): DriftCheckBaselines object (default: None).
2807
+ customer_metadata_properties (dict[str, str]): A dictionary of key-value paired
2808
+ metadata properties (default: None).
2809
+
2806
2810
"""
2807
2811
2808
2812
request = get_create_model_package_request (
@@ -2819,7 +2823,14 @@ def create_model_package_from_containers(
2819
2823
approval_status ,
2820
2824
description ,
2821
2825
drift_check_baselines = drift_check_baselines ,
2826
+ customer_metadata_properties = customer_metadata_properties ,
2822
2827
)
2828
+ try :
2829
+ self .sagemaker_client .describe_model_package_group (
2830
+ ModelPackageGroupName = request ["ModelPackageGroupName" ])
2831
+ except ClientError as e :
2832
+ self .sagemaker_client .create_model_package_group (
2833
+ ModelPackageGroupName = request ["ModelPackageGroupName" ])
2823
2834
return self .sagemaker_client .create_model_package (** request )
2824
2835
2825
2836
def wait_for_model_package (self , model_package_name , poll = 5 ):
@@ -4120,6 +4131,7 @@ def get_model_package_args(
4120
4131
tags = None ,
4121
4132
container_def_list = None ,
4122
4133
drift_check_baselines = None ,
4134
+ customer_metadata_properties = None ,
4123
4135
):
4124
4136
"""Get arguments for create_model_package method.
4125
4137
@@ -4148,6 +4160,8 @@ def get_model_package_args(
4148
4160
(default: None).
4149
4161
container_def_list (list): A list of container defintiions (default: None).
4150
4162
drift_check_baselines (DriftCheckBaselines): DriftCheckBaselines object (default: None).
4163
+ customer_metadata_properties (dict[str, str]): A dictionary of key-value paired
4164
+ metadata properties (default: None).
4151
4165
Returns:
4152
4166
dict: A dictionary of method argument names and values.
4153
4167
"""
@@ -4185,6 +4199,8 @@ def get_model_package_args(
4185
4199
model_package_args ["description" ] = description
4186
4200
if tags is not None :
4187
4201
model_package_args ["tags" ] = tags
4202
+ if customer_metadata_properties is not None :
4203
+ model_package_args ["customer_metadata_properties" ] = customer_metadata_properties
4188
4204
return model_package_args
4189
4205
4190
4206
@@ -4203,6 +4219,7 @@ def get_create_model_package_request(
4203
4219
description = None ,
4204
4220
tags = None ,
4205
4221
drift_check_baselines = None ,
4222
+ customer_metadata_properties = None ,
4206
4223
):
4207
4224
"""Get request dictionary for CreateModelPackage API.
4208
4225
@@ -4229,6 +4246,8 @@ def get_create_model_package_request(
4229
4246
tags (List[dict[str, str]]): A list of dictionaries containing key-value pairs
4230
4247
(default: None).
4231
4248
drift_check_baselines (DriftCheckBaselines): DriftCheckBaselines object (default: None).
4249
+ customer_metadata_properties (dict[str, str]): A dictionary of key-value paired
4250
+ metadata properties (default: None).
4232
4251
"""
4233
4252
4234
4253
if all ([model_package_name , model_package_group_name ]):
@@ -4250,6 +4269,8 @@ def get_create_model_package_request(
4250
4269
request_dict ["DriftCheckBaselines" ] = drift_check_baselines
4251
4270
if metadata_properties :
4252
4271
request_dict ["MetadataProperties" ] = metadata_properties
4272
+ if customer_metadata_properties is not None :
4273
+ request_dict ["CustomerMetadataProperties" ] = customer_metadata_properties
4253
4274
if containers is not None :
4254
4275
if not all ([content_types , response_types , inference_instances , transform_instances ]):
4255
4276
raise ValueError (
0 commit comments