@@ -62,7 +62,7 @@ def move_to_destination(source, destination, job_name, sagemaker_session):
62
62
final_uri = destination
63
63
elif parsed_uri .scheme == "s3" :
64
64
bucket = parsed_uri .netloc
65
- path = _create_s3_path (parsed_uri .path , job_name )
65
+ path = _create_s3_prefix (parsed_uri .path , job_name )
66
66
final_uri = "s3://%s/%s" % (bucket , path )
67
67
sagemaker_session .upload_data (source , bucket , path )
68
68
else :
@@ -72,9 +72,20 @@ def move_to_destination(source, destination, job_name, sagemaker_session):
72
72
return final_uri
73
73
74
74
75
- def _create_s3_path (prefix , job_name ):
76
- prefix = prefix .strip ("/" )
77
- return job_name if prefix == "" else "/" .join ((prefix , job_name ))
75
+ def _create_s3_prefix (path , job_name ):
76
+ """Constructs a path out of the given path and job name to be
77
+ used as an S3 prefix.
78
+
79
+ Args:
80
+ path (str): the original path. If the path is only ``"/"``,
81
+ then it is ignored.
82
+ job_name (str): the job name to be appended to the path.
83
+
84
+ Returns:
85
+ str: an S3 prefix of the form ``"path/job_name"``
86
+ """
87
+ path = path .strip ("/" )
88
+ return job_name if path == "" else "/" .join ((path , job_name ))
78
89
79
90
80
91
def recursive_copy (source , destination ):
0 commit comments