File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -824,12 +824,20 @@ def close(self) -> None:
824824 return
825825
826826 file_paths = dict ()
827- for filename in scandir (self .cfg .work_dir , self ._artifact_suffix ,
828- True ):
829- file_path = osp .join (self .cfg .work_dir , filename )
830- relative_path = os .path .relpath (file_path , self .cfg .work_dir )
831- dir_path = os .path .dirname (relative_path )
832- file_paths [file_path ] = dir_path
827+ if (hasattr (self , 'cfg' )
828+ and osp .isdir (getattr (self .cfg , 'work_dir' , '' ))):
829+ for filename in scandir (
830+ self .cfg .work_dir ,
831+ self ._artifact_suffix ,
832+ recursive = True ,
833+ ):
834+ file_path = str (osp .join (self .cfg .work_dir , filename ))
835+ relative_path = os .path .relpath (file_path , self .cfg .work_dir )
836+ dir_path = os .path .dirname (relative_path )
837+ file_paths [file_path ] = dir_path
838+ else :
839+ warnings .warn ('self.cfg.work_dir is not set, thus some '
840+ 'artifacts will not be logged' )
833841
834842 for file_path , dir_path in file_paths .items ():
835843 self ._mlflow .log_artifact (file_path , dir_path )
You can’t perform that action at this time.
0 commit comments