Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions dvc/remote/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,26 +588,23 @@ def download(
def _download_dir(
self, from_info, to_info, name, no_progress_bar, file_mode, dir_mode
):
file_to_infos = (
to_info / file_to_info.relative_to(from_info)
for file_to_info in self.walk_files(from_info)
from_infos = list(self.walk_files(from_info))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might a significant delay here before we see pbar. May ignore this for now though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Suor Very good point! It has similar reasons to what @shcheklein brought up in his -d s3://path/to/dir research(which is _collect_dir's fault). I'll fix it in #2911 .

to_infos = (
to_info / info.relative_to(from_info) for info in from_infos
)

with ThreadPoolExecutor(max_workers=self.JOBS) as executor:
file_from_info = list(self.walk_files(from_info))
download_files = partial(
self._download_file,
name=name,
no_progress_bar=True,
file_mode=file_mode,
dir_mode=dir_mode,
)
futures = executor.map(
download_files, file_from_info, file_to_infos
)
futures = executor.map(download_files, from_infos, to_infos)
with Tqdm(
futures,
total=len(file_from_info),
total=len(from_infos),
desc="Downloading directory",
unit="Files",
disable=no_progress_bar,
Expand Down