Skip to content

Commit 2c6b973

Browse files
committed
fix(core): Transformer tags pydantic validation and shape compatibility
1 parent a24011d commit 2c6b973

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎sagemaker-core/src/sagemaker/core/transformer.py‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ def submit(request):
409409
from sagemaker.core.utils.code_injection.codec import transform as transform_util
410410

411411
transformed = transform_util(serialized_request, "CreateTransformJobRequest")
412-
# Remove tags from transformed dict as TransformJob resource doesn't accept it
412+
# TransformJob does not accept 'tags'/'Tags', so we must pop them to avoid pydantic ValidationError
413413
transformed.pop("tags", None)
414+
transformed.pop("Tags", None)
414415
self.latest_transform_job = TransformJob(**transformed)
415416

416417
if wait:
@@ -716,7 +717,16 @@ def _get_transform_request(
716717
transform_request["Environment"] = env
717718

718719
if tags is not None:
719-
transform_request["Tags"] = tags
720+
from sagemaker.core.common_utils import format_tags
721+
formatted_tags = format_tags(tags)
722+
723+
if isinstance(formatted_tags, list):
724+
formatted_tags = [
725+
{"Key": t.get("Key", t.get("key", "")), "Value": t.get("Value", t.get("value", ""))}
726+
if isinstance(t, dict) else t
727+
for t in formatted_tags
728+
]
729+
transform_request["Tags"] = formatted_tags
720730

721731
if data_processing is not None:
722732
transform_request["DataProcessing"] = data_processing

0 commit comments

Comments
 (0)