Skip to content

Commit

Permalink
import: fix broken progressbar when importing folder (#10678)
Browse files Browse the repository at this point in the history
Co-authored-by: Petr Chmelar <[email protected]>
Co-authored-by: skshetry <[email protected]>
  • Loading branch information
3 people authored Jan 31, 2025
1 parent b2a873d commit da1e0b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dvc/fs/dvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def get(
**kwargs,
)

def _get( # noqa: C901, PLR0912
def _get( # noqa: C901, PLR0912, PLR0915
self,
rpath,
lpath,
Expand Down Expand Up @@ -578,7 +578,8 @@ def get_file(arg: tuple[FileSystem, tuple[str, str, Optional[dict]]]):
kw = kwargs
if isinstance(fs, DataFileSystem):
kw = kw | {"info": info}
return fs.get_file(src, dest, callback=callback, **kw)
with callback.branched(src, dest) as child:
fs.get_file(src, dest, callback=child, **kw)

if batch_size == 1:
ctx: AbstractContextManager = nullcontext()
Expand All @@ -589,7 +590,7 @@ def get_file(arg: tuple[FileSystem, tuple[str, str, Optional[dict]]]):

with ctx:
it = ((fs, f) for fs, files in _files.items() for f in files)
deque(map_fn(get_file, it), maxlen=0)
deque(callback.wrap(map_fn(get_file, it)), maxlen=0)
return result

def get_file(self, rpath, lpath, **kwargs):
Expand Down

0 comments on commit da1e0b5

Please sign in to comment.