Skip to content

fix: add description parameter for RegisterModelStep #2190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/sagemaker/workflow/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def __init__(
approval_status="PendingManualApproval",
image_uri=None,
compile_model_family=None,
description=None,
**kwargs,
):
"""Constructor of a register model step.
Expand All @@ -246,6 +247,7 @@ def __init__(
Estimator's training container image will be used (default: None).
compile_model_family (str): Instance family for compiled model, if specified, a compiled
model will be used (default: None).
description (str): Model Package description (default: None).
**kwargs: additional arguments to `create_model`.
"""
super(_RegisterModelStep, self).__init__(name, StepTypeEnum.REGISTER_MODEL)
Expand All @@ -261,6 +263,7 @@ def __init__(
self.approval_status = approval_status
self.image_uri = image_uri
self.compile_model_family = compile_model_family
self.description = description
self.kwargs = kwargs

self._properties = Properties(
Expand Down Expand Up @@ -314,6 +317,7 @@ def arguments(self) -> RequestType:
model_metrics=self.model_metrics,
metadata_properties=self.metadata_properties,
approval_status=self.approval_status,
description=self.description,
)
request_dict = model.sagemaker_session._get_create_model_package_request(
**model_package_args
Expand Down
3 changes: 3 additions & 0 deletions src/sagemaker/workflow/step_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def __init__(
approval_status=None,
image_uri=None,
compile_model_family=None,
description=None,
**kwargs,
):
"""Construct steps `_RepackModelStep` and `_RegisterModelStep` based on the estimator.
Expand All @@ -89,6 +90,7 @@ def __init__(
Estimator's training container image is used (default: None).
compile_model_family (str): The instance family for the compiled model. If
specified, a compiled model is used (default: None).
description (str): Model Package description (default: None).
**kwargs: additional arguments to `create_model`.
"""
steps: List[Step] = []
Expand Down Expand Up @@ -120,6 +122,7 @@ def __init__(
approval_status=approval_status,
image_uri=image_uri,
compile_model_family=compile_model_family,
description=description,
**kwargs,
)
steps.append(register_model_step)
Expand Down
1 change: 1 addition & 0 deletions tests/integ/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ def test_conditional_pytorch_training_model_registration(
response_types=["*"],
inference_instances=["*"],
transform_instances=["*"],
description="test-description",
)

model = Model(
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/sagemaker/workflow/test_step_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def test_register_model(estimator, model_metrics):
model_package_group_name="mpg",
model_metrics=model_metrics,
approval_status="Approved",
description="description",
)
assert ordered(register_model.request_dicts()) == ordered(
[
Expand All @@ -168,6 +169,7 @@ def test_register_model(estimator, model_metrics):
},
},
},
"ModelPackageDescription": "description",
"ModelPackageGroupName": "mpg",
},
},
Expand Down