File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -493,4 +493,5 @@ def _precompute_image_paths(self) -> None:
493493 raise FileNotFoundError (
494494 f"Cannot find image for uuid { uuid } "
495495 )
496+
496497 self .idx_to_img_path [idx ] = img_path
Original file line number Diff line number Diff line change @@ -410,12 +410,25 @@ def get_dir(
410410
411411 if isinstance (remote_paths , list ):
412412 local_dir .mkdir (parents = True , exist_ok = True )
413+ futures = []
414+
413415 with ThreadPoolExecutor () as executor :
414416 for remote_path in remote_paths :
415417 local_path = (
416418 local_dir / PurePosixPath (remote_path ).name
417419 )
418- executor .submit (self .get_file , remote_path , local_path )
420+ future = executor .submit (
421+ self .get_file , remote_path , local_path
422+ )
423+ futures .append (future )
424+
425+ for future in as_completed (futures ):
426+ try :
427+ future .result ()
428+ except Exception as e :
429+ raise RuntimeError (
430+ f"Failed to download file: { e } "
431+ ) from e
419432
420433 return Path (local_dir )
421434
You can’t perform that action at this time.
0 commit comments