-
Notifications
You must be signed in to change notification settings - Fork 419
Closed
Description
As of 2021.7.0, any put operations that use lists of files raise an assertion error.
I believe this is a general issue with fsspec asyn, but have tested this with GCS.
In [1]: import fsspec
In [2]: fs = fsspec.get_filesystem_class('gs')()
In [3]: !tree .
.
├── e1.txt
└── e2.txt
0 directories, 2 files
In [4]: fs.put(['e1.txt', 'e2.txt'], ['gs://redacted/e1.txt', 'gs://redacted/e2.txt'], recursive=False)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
....
~/.pyenv/versions/3.7.4/envs/blocks/lib/python3.7/site-packages/fsspec/asyn.py in _put(self, lpath, rpath, recursive, callback, **kwargs)
380 lpaths = fs.expand_path(lpath, recursive=recursive)
381 dirs = [l for l in lpaths if os.path.isdir(l)]
--> 382 rdirs = other_paths(dirs, rpath)
383 await asyncio.gather(*[self._makedirs(d, exist_ok=True) for d in rdirs])
384 files = sorted(set(lpaths) - set(dirs))
~/.pyenv/versions/3.7.4/envs/blocks/lib/python3.7/site-packages/fsspec/utils.py in other_paths(paths, path2, is_dir)
366 path2 = [path2]
367 else:
--> 368 assert len(paths) == len(path2)
369 return path2
370
I believe this was introduced with this change 19e57e0#diff-9e28a72564624d8305a58b77c04c514d15e016b61899fd507b52b30388ef6ab6, since the other_paths is asserting equal length lists but the directories filter empties the source list.
It looks like the intent of that function is to support the input list being any combination of directories and files, and the change just happened to break the case where rpaths is a list (which needs a slightly more complicated implementation)? If that's correct I can submit a fix.
Metadata
Metadata
Assignees
Labels
No labels