You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Share the upload body of put_file() with the async transaction write, and check put sources once #1427
These were found while reviewing #1426 (#1404). They predate it and are outside its scope.
1. The upload body of put_file() exists twice
AioS3FileSystem._put_file_in_transaction() (pyathena/filesystem/s3_async.py) repeats the body of S3FileSystem.put_file() line for line, except for the opener:
the directory and bucket checks;
the size check against the part count;
the ContentType guess;
the write of the local file;
the invalidation.
#1426 had to make each change to destinations twice. The pipe_file() body is split the same way.
S3FileSystem._open_path() and _S3TransactionWrite.open() now have the same signature: (path: str | S3Path, mode, **kwargs) -> S3File. So a private sync upload body that takes the opener could serve both, reducing _put_file_in_transaction() to a call.
2. The async _put() checks each local path twice and windows no parts
AioS3FileSystem._put() calls os.path.isdir() on the event loop for every pair to leave out the directories. fsspec's _put() used to check them again; since Type put destinations and document path addressing (GH-1404) #1426, _transfer_pairs() runs the uploads instead. A single check, in the thread that pairs the paths, would keep os.path.isdir() off the loop.
Unlike _get(), _put() does not pass its uploads the max_workers window that _batch_kwargs() computes. So each upload may send up to max_workers parts at once, however many uploads run.
Two more items from the review of #1426, which also predate it:
3. The async _get() and a skipped _put() differ from fsspec's results
_get():AioS3FileSystem._get() returns None. fsspec's _get() returns the list of the _get_file() results, as _put() does. That is [None] for one file with the default callback, and a custom branch_coro() wrapper can change the values.
A skipped _put(): given a single local directory as a string without recursive, it calls callback.set_size(0) and returns []. fsspec returns None before it uses the callback.
Section 3 (the results of the async _get() and of a _put() that uploads nothing) moves to #1429, since it changes return values to match fsspec. This issue keeps sections 1 and 2.
Activity
laughingman7743 commentedon Nov 21, 2026
Two more items from the review of #1426, which also predate it:
3. The async
_get()and a skipped_put()differ from fsspec's results_get():AioS3FileSystem._get()returnsNone. fsspec's_get()returns the list of the_get_file()results, as_put()does. That is[None]for one file with the default callback, and a custombranch_coro()wrapper can change the values._put(): given a single local directory as a string withoutrecursive, it callscallback.set_size(0)and returns[]. fsspec returnsNonebefore it uses the callback.laughingman7743 commentedon Nov 21, 2026
Section 3 (the results of the async
_get()and of a_put()that uploads nothing) moves to #1429, since it changes return values to match fsspec. This issue keeps sections 1 and 2.