@@ -53,7 +53,7 @@ def copy_directory_structure(destination_directory, relative_path):
5353 os .makedirs (destination_directory , relative_path )
5454
5555
56- def move_to_destination (source , destination , job_name , sagemaker_session ):
56+ def move_to_destination (source , destination , job_name , sagemaker_session , prefix = "" ):
5757 """Move source to destination.
5858
5959 Can handle uploading to S3.
@@ -64,6 +64,8 @@ def move_to_destination(source, destination, job_name, sagemaker_session):
6464 job_name (str): SageMaker job name.
6565 sagemaker_session (sagemaker.Session): a sagemaker_session to interact
6666 with S3 if needed
67+ prefix (str, optional): the directory on S3 used to save files, default
68+ to the root of ``destination``
6769
6870 Returns:
6971 (str): destination URI
@@ -75,7 +77,7 @@ def move_to_destination(source, destination, job_name, sagemaker_session):
7577 final_uri = destination
7678 elif parsed_uri .scheme == "s3" :
7779 bucket = parsed_uri .netloc
78- path = s3 .s3_path_join (parsed_uri .path , job_name )
80+ path = s3 .s3_path_join (parsed_uri .path , job_name , prefix )
7981 final_uri = s3 .s3_path_join ("s3://" , bucket , path )
8082 sagemaker_session .upload_data (source , bucket , path )
8183 else :
0 commit comments