-
Notifications
You must be signed in to change notification settings - Fork 0
fix: [Bug] Pipeline parameters (ParameterInteger, ParameterString) fail in ModelTrain (5504) #28
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -410,14 +410,18 @@ def __del__(self): | |
| self._temp_code_dir.cleanup() | ||
|
|
||
| def _validate_training_image_and_algorithm_name( | ||
| self, training_image: Optional[str], algorithm_name: Optional[str] | ||
| self, training_image, algorithm_name | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing test file in the diff: The PR description references |
||
| ): | ||
|
aviruthen marked this conversation as resolved.
|
||
| """Validate that only one of 'training_image' or 'algorithm_name' is provided.""" | ||
|
aviruthen marked this conversation as resolved.
|
||
| if not training_image and not algorithm_name: | ||
| from sagemaker.core.helper.pipeline_variable import PipelineVariable as _PV | ||
| # PipelineVariables are truthy for validation purposes | ||
| has_image = isinstance(training_image, _PV) or bool(training_image) | ||
| has_algo = isinstance(algorithm_name, _PV) or bool(algorithm_name) | ||
| if not has_image and not has_algo: | ||
|
aviruthen marked this conversation as resolved.
|
||
| raise ValueError( | ||
| "Atleast one of 'training_image' or 'algorithm_name' must be provided.", | ||
| ) | ||
| if training_image and algorithm_name: | ||
| if has_image and has_algo: | ||
| raise ValueError( | ||
| "Only one of 'training_image' or 'algorithm_name' must be provided.", | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,7 +142,7 @@ def _get_unique_name(base, max_length=63): | |
| return unique_name | ||
|
|
||
|
|
||
| def _get_repo_name_from_image(image: str) -> str: | ||
| def _get_repo_name_from_image(image) -> str: | ||
| """Get the repository name from the image URI. | ||
|
aviruthen marked this conversation as resolved.
|
||
|
|
||
| Example: | ||
|
|
@@ -152,11 +152,13 @@ def _get_repo_name_from_image(image: str) -> str: | |
| ``` | ||
|
|
||
| Args: | ||
| image (str): The image URI | ||
| image: The image URI (str or PipelineVariable) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed type annotation: Same issue here — the def _get_repo_name_from_image(image: str | PipelineVariable) -> str: |
||
|
|
||
| Returns: | ||
|
aviruthen marked this conversation as resolved.
|
||
| str: The repository name | ||
| """ | ||
| if isinstance(image, PipelineVariable): | ||
|
aviruthen marked this conversation as resolved.
|
||
| return "pipeline-variable-image" | ||
| return image.split("/")[-1].split(":")[0].split("@")[0] | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing type annotations: The type annotations for
training_imageandalgorithm_namewere removed entirely. Per SDK coding standards (PEP 484), all public/private methods must retain type annotations. Since these parameters now accept bothstrandPipelineVariable, please use the appropriate union type:Or if
StrPipeVaris already defined as a type alias in the codebase, use that.