Skip to content

Commit e657470

Browse files
committed
wait to download
1 parent af1969d commit e657470

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

luxonis_ml/data/loaders/luxonis_loader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

luxonis_ml/utils/filesystem.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)