From 004ffbad187d5f660adf0e2c28e148e515da772b Mon Sep 17 00:00:00 2001 From: aviruthen <91846056+aviruthen@users.noreply.github.com> Date: Fri, 20 Mar 2026 18:36:40 -0400 Subject: [PATCH 1/2] fix: Pipeline TypeError: can only concatenate list (not "NoneType") to list Using Sou (#5518) --- .../src/sagemaker/core/workflow/utilities.py | 2 + .../tests/unit/workflow/test_utilities.py | 60 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/sagemaker-core/src/sagemaker/core/workflow/utilities.py b/sagemaker-core/src/sagemaker/core/workflow/utilities.py index c07a31c51e..c5fd6a22b6 100644 --- a/sagemaker-core/src/sagemaker/core/workflow/utilities.py +++ b/sagemaker-core/src/sagemaker/core/workflow/utilities.py @@ -210,6 +210,8 @@ def get_processing_code_hash(code: str, source_dir: str, dependencies: List[str] str: A hash string representing the unique code artifact(s) for the step """ + dependencies = dependencies or [] + # FrameworkProcessor if source_dir: source_dir_url = urlparse(source_dir) diff --git a/sagemaker-core/tests/unit/workflow/test_utilities.py b/sagemaker-core/tests/unit/workflow/test_utilities.py index 5e9ed7bbbd..d304ec6481 100644 --- a/sagemaker-core/tests/unit/workflow/test_utilities.py +++ b/sagemaker-core/tests/unit/workflow/test_utilities.py @@ -250,6 +250,35 @@ def test_get_processing_code_hash_s3_uri(self): assert result is None def test_get_processing_code_hash_with_dependencies(self): + + def test_get_processing_code_hash_with_none_dependencies(self): + """Test get_processing_code_hash with None dependencies does not raise TypeError""" + with tempfile.TemporaryDirectory() as temp_dir: + code_file = Path(temp_dir, "script.py") + code_file.write_text("print('hello')") + + # Should not raise TypeError when dependencies is None + result = get_processing_code_hash( + code=str(code_file), source_dir=temp_dir, dependencies=None + ) + + assert result is not None + assert len(result) == 64 + + def test_get_processing_code_hash_code_only_with_none_dependencies(self): + """Test get_processing_code_hash with code only and None dependencies""" + with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f: + f.write("print('hello')") + temp_file = f.name + + try: + result = get_processing_code_hash(code=temp_file, source_dir=None, dependencies=None) + + assert result is not None + assert len(result) == 64 + finally: + os.unlink(temp_file) + """Test get_processing_code_hash with dependencies""" with tempfile.TemporaryDirectory() as temp_dir: code_file = Path(temp_dir, "script.py") @@ -317,6 +346,37 @@ def test_get_training_code_hash_s3_uri(self): assert result is None def test_get_training_code_hash_pipeline_variable(self): + + def test_get_training_code_hash_with_none_dependencies_source_dir(self): + """Test get_training_code_hash with None dependencies and source_dir""" + with tempfile.TemporaryDirectory() as temp_dir: + entry_file = Path(temp_dir, "train.py") + entry_file.write_text("print('training')") + + # Should not raise TypeError when dependencies is None + result = get_training_code_hash( + entry_point=str(entry_file), source_dir=temp_dir, dependencies=None + ) + + assert result is not None + assert len(result) == 64 + + def test_get_training_code_hash_with_none_dependencies_entry_point_only(self): + """Test get_training_code_hash with None dependencies and entry_point only""" + with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f: + f.write("print('training')") + temp_file = f.name + + try: + result = get_training_code_hash( + entry_point=temp_file, source_dir=None, dependencies=None + ) + + assert result is not None + assert len(result) == 64 + finally: + os.unlink(temp_file) + """Test get_training_code_hash with pipeline variable returns None""" with patch("sagemaker.core.workflow.is_pipeline_variable", return_value=True): result = get_training_code_hash( From 84a4569c092f2794d501ba521c9d2b676ac302c7 Mon Sep 17 00:00:00 2001 From: aviruthen <91846056+aviruthen@users.noreply.github.com> Date: Fri, 20 Mar 2026 18:39:44 -0400 Subject: [PATCH 2/2] fix: address review comments (iteration #1) --- sagemaker-core/src/sagemaker/core/workflow/utilities.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sagemaker-core/src/sagemaker/core/workflow/utilities.py b/sagemaker-core/src/sagemaker/core/workflow/utilities.py index c5fd6a22b6..c07a31c51e 100644 --- a/sagemaker-core/src/sagemaker/core/workflow/utilities.py +++ b/sagemaker-core/src/sagemaker/core/workflow/utilities.py @@ -210,8 +210,6 @@ def get_processing_code_hash(code: str, source_dir: str, dependencies: List[str] str: A hash string representing the unique code artifact(s) for the step """ - dependencies = dependencies or [] - # FrameworkProcessor if source_dir: source_dir_url = urlparse(source_dir)