From 558d94238cf0aa631e3cb33f6596b3778bed9657 Mon Sep 17 00:00:00 2001 From: Zhankui Lu Date: Fri, 2 Sep 2022 14:40:34 -0700 Subject: [PATCH] Some improvement to the error messages. --- src/sagemaker/workflow/entities.py | 7 +++++-- src/sagemaker/workflow/model_step.py | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sagemaker/workflow/entities.py b/src/sagemaker/workflow/entities.py index e648037749..97400dcd0e 100644 --- a/src/sagemaker/workflow/entities.py +++ b/src/sagemaker/workflow/entities.py @@ -85,8 +85,11 @@ def __str__(self): """Override built-in String function for PipelineVariable""" raise TypeError( "Pipeline variables do not support __str__ operation. " - "Please use `.to_string()` to convert it to string type in execution time" - "or use `.expr` to translate it to Json for display purpose in Python SDK." + "If you are trying to use a pipeline variable in an Estimator, Processor or Model " + "object, please make sure the object is built with a PipelineSession object." + "If you are trying to convert a pipeline variable of any type into a pipeline variable " + "of string type, please use `.to_string()` method." + "Use `.expr` method to display the expression structure of the pipeline variable." ) def __int__(self): diff --git a/src/sagemaker/workflow/model_step.py b/src/sagemaker/workflow/model_step.py index 254e5cb15b..b7d98a73d8 100644 --- a/src/sagemaker/workflow/model_step.py +++ b/src/sagemaker/workflow/model_step.py @@ -124,8 +124,9 @@ def __init__( Session.create_model.__name__, Session.create_model_package_from_containers.__name__, }, - error_message="The step_args of ModelStep must be obtained from model.create() " - "or model.register(). For more, see: https://sagemaker.readthedocs.io/en/stable/" + error_message="The step_args of ModelStep must be obtained from the create method " + "or register method of a Model object and the Model object must be built with " + "PipelineSession. For more, see: https://sagemaker.readthedocs.io/en/stable/" "amazon_sagemaker_model_building_pipeline.html#model-step", ) if not (step_args.create_model_request is None) ^ (