Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make remote directories before put_files #686

Merged
merged 4 commits into from
Jun 28, 2021
Merged
Changes from 2 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
8 changes: 6 additions & 2 deletions fsspec/asyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,16 @@ async def _put(self, lpath, rpath, recursive=False, **kwargs):
lpath = make_path_posix(lpath)
fs = LocalFileSystem()
lpaths = fs.expand_path(lpath, recursive=recursive)
rpaths = other_paths(lpaths, rpath)
dirs = [l for l in lpaths if os.path.isdir(l)]
rdirs = other_paths(dirs, rpath)
await _throttled_gather([self._makedirs(d, exist_ok=True) for d in rdirs])
martindurant marked this conversation as resolved.
Show resolved Hide resolved
files = sorted(set(lpaths) - set(dirs))
rpaths = other_paths(files, rpath)
batch_size = kwargs.pop("batch_size", self.batch_size)
return await _throttled_gather(
[
self._put_file(lpath, rpath, **kwargs)
for lpath, rpath in zip(lpaths, rpaths)
for lpath, rpath in zip(files, rpaths)
],
batch_size=batch_size,
)
Expand Down