Conversation
…o list Using Sou (aws#5518)
aviruthen
commented
Mar 20, 2026
Owner
Author
There was a problem hiding this comment.
Can you remove only the comment you left on the PR explaining why you added the code dependencies = dependences or []?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix TypeError in Pipeline.upsert() when SourceCode.requirements is None
Fixes aws#5518
Problem
When calling
pipeline.upsert()with aTrainingStepwhoseSourceCodeobject has norequirementsset (defaults toNone), aTypeErroris raised becauseNoneis concatenated with a list in the code hashing utilities.Specifically,
get_processing_code_hash()has unguarded+ dependencieslist concatenation that fails whendependenciesisNone. Whileget_training_code_hash()already hasif dependencies:guards, the processing code hash function did not have this protection.Solution
Added defensive
None-to-empty-list coercion (dependencies = dependencies or []) at the start ofget_processing_code_hash()to preventTypeErrorwhendependenciesisNoneand gets concatenated with a list.The
get_training_code_hash()function already handlesNonecorrectly via its existingif dependencies:conditional checks.Testing
Added test cases to verify:
get_processing_code_hash()works correctly whendependencies=None(with and withoutsource_dir)get_training_code_hash()works correctly whendependencies=None(withsource_dirand withentry_pointonly)Related Issue
Fixes aws#5518
Changes Made
The bug occurs when
pipeline.upsert()is called with aTrainingStepwhoseSourceCodeobject has norequirementsset (defaults toNone). Inget_code_hash()withinsagemaker-core/src/sagemaker/core/workflow/utilities.py,source_code.requirements(which isNone) is passed as thedependenciesparameter toget_training_code_hash(). While the currentget_training_code_hash()has anif dependencies:guard, the issue traceback suggests an older version hadhash_files_or_dirs([source_dir] + dependencies)without that guard. Additionally,get_processing_code_hash()still has unguarded+ dependenciesconcatenation that would fail withNone. The fix should ensure both functions defensively handleNonedependencies, and that the caller inget_code_hash()normalizesNoneto a safe default before passing it along.AI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat