Skip to content
16 changes: 11 additions & 5 deletions sagemaker-core/src/sagemaker/core/workflow/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ def get_training_code_hash(entry_point: str, source_dir: str, dependencies: List
training
source_dir (str): Path to a directory with any other training source
code dependencies aside from the entry point file
dependencies (str): A list of paths to directories (absolute
or relative) with any additional libraries that will be exported
to the container
dependencies (str): The relative path within ``source_dir`` to a
Comment thread
mollyheamazon marked this conversation as resolved.
Outdated
``requirements.txt`` file with any additional libraries that
will be exported to the container
Returns:
str: A hash string representing the unique code artifact(s) for the step
"""
Expand All @@ -248,11 +248,17 @@ def get_training_code_hash(entry_point: str, source_dir: str, dependencies: List
if source_dir:
source_dir_url = urlparse(source_dir)
if source_dir_url.scheme == "" or source_dir_url.scheme == "file":
return hash_files_or_dirs([source_dir] + dependencies)
if dependencies:
return hash_files_or_dirs([source_dir] + [dependencies])
else:
return hash_files_or_dirs([source_dir])
elif entry_point:
entry_point_url = urlparse(entry_point)
if entry_point_url.scheme == "" or entry_point_url.scheme == "file":
return hash_files_or_dirs([entry_point] + dependencies)
if dependencies:
return hash_files_or_dirs([entry_point] + [dependencies])
else:
return hash_files_or_dirs([source_dir])
Comment thread
mollyheamazon marked this conversation as resolved.
Outdated
return None


Expand Down
Loading