Skip to content

Commit 5251171

Browse files
authored
remote: base: download: don't walk dir twice
1 parent 9b6644a commit 5251171

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dvc/remote/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,13 @@ def download(
588588
def _download_dir(
589589
self, from_info, to_info, name, no_progress_bar, file_mode, dir_mode
590590
):
591-
file_to_infos = (
592-
to_info / file_to_info.relative_to(from_info)
593-
for file_to_info in self.walk_files(from_info)
591+
from_infos = list(self.walk_files(from_info))
592+
to_infos = (
593+
to_info / info.relative_to(from_info)
594+
for info in from_infos
594595
)
595596

596597
with ThreadPoolExecutor(max_workers=self.JOBS) as executor:
597-
file_from_info = list(self.walk_files(from_info))
598598
download_files = partial(
599599
self._download_file,
600600
name=name,
@@ -603,11 +603,11 @@ def _download_dir(
603603
dir_mode=dir_mode,
604604
)
605605
futures = executor.map(
606-
download_files, file_from_info, file_to_infos
606+
download_files, from_infos, to_infos
607607
)
608608
with Tqdm(
609609
futures,
610-
total=len(file_from_info),
610+
total=len(from_infos),
611611
desc="Downloading directory",
612612
unit="Files",
613613
disable=no_progress_bar,

0 commit comments

Comments
 (0)