Skip to content

Commit 1ca96d7

Browse files
committed
Fix handling of dependencies in get_training_code_hash workflow utility
1 parent 071ffa5 commit 1ca96d7

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

sagemaker-core/src/sagemaker/core/workflow/utilities.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ def get_training_code_hash(entry_point: str, source_dir: str, dependencies: List
236236
training
237237
source_dir (str): Path to a directory with any other training source
238238
code dependencies aside from the entry point file
239-
dependencies (str): A list of paths to directories (absolute
240-
or relative) with any additional libraries that will be exported
241-
to the container
239+
dependencies (str): The relative path within ``source_dir`` to a
240+
``requirements.txt`` file with any additional libraries that
241+
will be exported to the container
242242
Returns:
243243
str: A hash string representing the unique code artifact(s) for the step
244244
"""
@@ -248,11 +248,17 @@ def get_training_code_hash(entry_point: str, source_dir: str, dependencies: List
248248
if source_dir:
249249
source_dir_url = urlparse(source_dir)
250250
if source_dir_url.scheme == "" or source_dir_url.scheme == "file":
251-
return hash_files_or_dirs([source_dir] + dependencies)
251+
if dependencies:
252+
return hash_files_or_dirs([source_dir] + [dependencies])
253+
else:
254+
return hash_files_or_dirs([source_dir])
252255
elif entry_point:
253256
entry_point_url = urlparse(entry_point)
254257
if entry_point_url.scheme == "" or entry_point_url.scheme == "file":
255-
return hash_files_or_dirs([entry_point] + dependencies)
258+
if dependencies:
259+
return hash_files_or_dirs([entry_point] + [dependencies])
260+
else:
261+
return hash_files_or_dirs([source_dir])
256262
return None
257263

258264

0 commit comments

Comments
 (0)