From 2656a41a92d8682c13ce05c4f844e21ab828a587 Mon Sep 17 00:00:00 2001 From: aviruthen <91846056+aviruthen@users.noreply.github.com> Date: Mon, 23 Mar 2026 12:42:06 -0400 Subject: [PATCH] fix: Pipeline TypeError: can only concatenate list (not "NoneType") to list Using Sou (#5518) --- .../src/sagemaker/core/workflow/utilities.py | 4 ++- .../tests/unit/workflow/test_utilities.py | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/sagemaker-core/src/sagemaker/core/workflow/utilities.py b/sagemaker-core/src/sagemaker/core/workflow/utilities.py index c07a31c51e..6f35c23480 100644 --- a/sagemaker-core/src/sagemaker/core/workflow/utilities.py +++ b/sagemaker-core/src/sagemaker/core/workflow/utilities.py @@ -211,7 +211,9 @@ def get_processing_code_hash(code: str, source_dir: str, dependencies: List[str] """ # FrameworkProcessor - if source_dir: + dependencies = dependencies or [] + + source_dir_url = urlparse(source_dir) if source_dir_url.scheme == "" or source_dir_url.scheme == "file": # Include code in the hash when possible diff --git a/sagemaker-core/tests/unit/workflow/test_utilities.py b/sagemaker-core/tests/unit/workflow/test_utilities.py index 5e9ed7bbbd..3050e28f2f 100644 --- a/sagemaker-core/tests/unit/workflow/test_utilities.py +++ b/sagemaker-core/tests/unit/workflow/test_utilities.py @@ -249,6 +249,33 @@ def test_get_processing_code_hash_s3_uri(self): assert result is None + 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')") + + 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) + def test_get_processing_code_hash_with_dependencies(self): """Test get_processing_code_hash with dependencies""" with tempfile.TemporaryDirectory() as temp_dir: