@@ -192,14 +192,6 @@ def initialize_filesystems(self):
192192 )
193193 continue
194194
195- fs_class = fsspec .get_filesystem_class (fs_protocol )
196- if fs_class .async_impl :
197- fs = fsspec .filesystem (fs_protocol , asynchronous = True , * args , ** kwargs )
198- else :
199- sync_fs = fsspec .filesystem (fs_protocol , * args , ** kwargs )
200- fs = AsyncFileSystemWrapper (sync_fs )
201- logger .debug ("fs_path: %s" , fs_path )
202-
203195 # Store the filesystem instance
204196 fs_info = {
205197 "instance" : None ,
@@ -211,21 +203,46 @@ def initialize_filesystems(self):
211203 "args" : args ,
212204 "kwargs" : kwargs ,
213205 }
214- new_filesystems [key ] = fs_info
215- fs_class = fsspec .get_filesystem_class (fs_protocol )
216- if fs_class .async_impl :
217- fs = FileSystemManager .construct_fs (fs_protocol , True , * args , ** kwargs )
218- fs_info ["instance" ] = fs
219- else :
220- sync_fs = FileSystemManager .construct_fs (
221- fs_protocol , False , * args , ** kwargs
206+ try :
207+ fs_class = fsspec .get_filesystem_class (fs_protocol )
208+
209+ if fs_class .async_impl :
210+ fs = FileSystemManager .construct_fs (
211+ fs_protocol , True , * args , ** kwargs
212+ )
213+ fs_info ["instance" ] = fs
214+ else :
215+ sync_fs = FileSystemManager .construct_fs (
216+ fs_protocol , False , * args , ** kwargs
217+ )
218+ fs = AsyncFileSystemWrapper (sync_fs )
219+ fs_info ["instance" ] = fs
220+
221+ logger .debug (
222+ f"Initialized filesystem '{ fs_name } ' with protocol '{ fs_protocol } ' at path '{ fs_path } '"
223+ )
224+ except Exception :
225+ fs_info ["instance" ] = None
226+ logger .error (
227+ f"Failed to initialize filesystem '{ fs_name } ' at path '{ fs_path } '."
222228 )
223- fs = AsyncFileSystemWrapper (sync_fs )
224- fs_info ["instance" ] = fs
225229
226- logger .debug (
227- f"Initialized filesystem '{ fs_name } ' with protocol '{ fs_protocol } ' at path '{ fs_path } '"
228- )
230+ import traceback
231+
232+ traceback .print_exc ()
233+
234+ exc_type , exc_value , exc_tb = sys .exc_info ()
235+ error_info = {
236+ "type" : exc_type .__name__ ,
237+ "message" : str (exc_value ),
238+ "short_traceback" : traceback .format_exception_only (
239+ exc_type , exc_value
240+ )[- 1 ].strip (),
241+ "traceback_list" : traceback .format_tb (exc_tb ),
242+ }
243+ fs_info ["error" ] = error_info
244+
245+ new_filesystems [key ] = fs_info
229246
230247 self .filesystems = new_filesystems
231248 self .name_to_prefix = name_to_prefix
0 commit comments