@@ -53,7 +53,7 @@ def copy_directory_structure(destination_directory, relative_path):
53
53
os .makedirs (destination_directory , relative_path )
54
54
55
55
56
- def move_to_destination (source , destination , job_name , sagemaker_session ):
56
+ def move_to_destination (source , destination , job_name , sagemaker_session , prefix = "" ):
57
57
"""Move source to destination.
58
58
59
59
Can handle uploading to S3.
@@ -64,6 +64,8 @@ def move_to_destination(source, destination, job_name, sagemaker_session):
64
64
job_name (str): SageMaker job name.
65
65
sagemaker_session (sagemaker.Session): a sagemaker_session to interact
66
66
with S3 if needed
67
+ prefix (str, optional): the directory on S3 used to save files, default
68
+ to the root of ``destination``
67
69
68
70
Returns:
69
71
(str): destination URI
@@ -75,7 +77,7 @@ def move_to_destination(source, destination, job_name, sagemaker_session):
75
77
final_uri = destination
76
78
elif parsed_uri .scheme == "s3" :
77
79
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 )
79
81
final_uri = s3 .s3_path_join ("s3://" , bucket , path )
80
82
sagemaker_session .upload_data (source , bucket , path )
81
83
else :
0 commit comments