@@ -95,6 +95,32 @@ def test_log_artifact(trial_component_obj, bucket, tempdir, sagemaker_boto_clien
9595 assert prefix in loaded .output_artifacts [artifact_name ].value
9696
9797
98+ def test_log_artifacts (trial_component_obj , bucket , tempdir , sagemaker_boto_client ):
99+ prefix = name ()
100+ file_contents = "happy monkey monkey"
101+ file_path = os .path .join (tempdir , "foo.txt" )
102+ file_path1 = os .path .join (tempdir , "bar.txt" )
103+ with open (file_path , "w" ) as foo_file :
104+ foo_file .write (file_contents )
105+ with open (file_path1 , "w" ) as bar_file :
106+ bar_file .write (file_contents )
107+
108+ with tracker .Tracker .load (
109+ trial_component_obj .trial_component_name ,
110+ artifact_bucket = bucket ,
111+ artifact_prefix = prefix ,
112+ sagemaker_boto_client = sagemaker_boto_client ,
113+ ) as tracker_obj :
114+ tracker_obj .log_artifacts (tempdir )
115+ loaded = trial_component .TrialComponent .load (
116+ trial_component_name = trial_component_obj .trial_component_name , sagemaker_boto_client = sagemaker_boto_client
117+ )
118+ assert "text/plain" == loaded .output_artifacts ["foo" ].media_type
119+ assert prefix in loaded .output_artifacts ["foo" ].value
120+ assert "text/plain" == loaded .output_artifacts ["bar" ].media_type
121+ assert prefix in loaded .output_artifacts ["bar" ].value
122+
123+
98124def test_create_default_bucket (boto3_session ):
99125 bucket_name_prefix = _utils .name ("sm-test" )
100126 bucket = _utils .get_or_create_default_bucket (boto3_session , default_bucket_prefix = bucket_name_prefix )
0 commit comments