-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Pipeline TypeError: can only concatenate list (not "NoneType") to list Using Sou (#5518) #25
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 |
|---|---|---|
|
|
@@ -149,6 +149,8 @@ def get_code_hash(step: Entity) -> str: | |
| Returns: | ||
| str: A hash string representing the unique code artifact(s) for the step | ||
| """ | ||
|
|
||
|
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. Bug: Fix is applied to the wrong function. This line is inside The fix should be applied inside Additionally, you should also consider fixing dependencies = source_code.requirements or []before passing it to the downstream hash functions. |
||
| dependencies = dependencies or [] | ||
| from sagemaker.mlops.workflow.steps import ProcessingStep, TrainingStep | ||
|
|
||
| if isinstance(step, ProcessingStep) and step.step_args: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,6 +264,48 @@ def test_get_processing_code_hash_with_dependencies(self): | |
|
|
||
|
aviruthen marked this conversation as resolved.
|
||
| assert result is not None | ||
|
|
||
|
aviruthen marked this conversation as resolved.
|
||
| def test_get_processing_code_hash_with_none_dependencies(self): | ||
| """Test get_processing_code_hash with None dependencies does not raise TypeError""" | ||
| 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) | ||
|
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. Nit: There's an extra blank line here (two blank lines between methods inside a class). PEP 8 convention for methods within a class is one blank line. This is minor but worth noting since CI may flag it. |
||
|
|
||
| assert result is not None | ||
| assert len(result) == 64 | ||
| finally: | ||
| os.unlink(temp_file) | ||
|
|
||
| def test_get_processing_code_hash_with_source_dir_and_none_dependencies(self): | ||
| """Test get_processing_code_hash with source_dir and None dependencies""" | ||
| 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 | ||
| ) | ||
|
aviruthen marked this conversation as resolved.
|
||
|
|
||
| assert result is not None | ||
| assert len(result) == 64 | ||
|
|
||
| def test_get_processing_code_hash_with_code_only_and_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: | ||
| # Ensure no TypeError when dependencies is None | ||
| 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_training_code_hash_with_source_dir(self): | ||
| """Test get_training_code_hash with source_dir""" | ||
| with tempfile.TemporaryDirectory() as temp_dir: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.