Skip to content

Commit

Permalink
fix: add warning message for job-prefixed pipeline steps when no job …
Browse files Browse the repository at this point in the history
…name is provided
  • Loading branch information
svia3 committed Jan 12, 2024
1 parent d083396 commit 2ffab7a
Show file tree
Hide file tree
Showing 2 changed files with 207 additions and 173 deletions.
10 changes: 10 additions & 0 deletions src/sagemaker/workflow/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
"if desired."
)

# pylint: disable=C0301
JOB_KEY_NONE_WARN_MSG_TEMPLATE = (
"Invalid input: the use_custom_job_prefix is set but the name field [{}] has not been specified. "
"Please refer to the AWS Docs to identify which field should be set to enable the "
"custom-prefixing feature for jobs created via a pipeline execution. "
"https://docs.aws.amazon.com/sagemaker/latest/dg/build-and-manage-access.html#build-and-manage-step-permissions-prefix"
)

if TYPE_CHECKING:
from sagemaker.workflow.step_collections import StepCollection

Expand Down Expand Up @@ -458,6 +466,8 @@ def trim_request_dict(request_dict, job_key, config):
request_dict.pop(job_key, None) # safely return null in case of KeyError
else:
if job_key in request_dict:
if request_dict[job_key] is None:
raise ValueError(JOB_KEY_NONE_WARN_MSG_TEMPLATE.format(job_key))
request_dict[job_key] = base_from_name(request_dict[job_key]) # trim timestamp

return request_dict
Expand Down
Loading

0 comments on commit 2ffab7a

Please sign in to comment.