-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fs.upload: add support for optional callback #6546
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
Conversation
8524c36
to
32c4cb3
Compare
ExtraArgs=self.fs_args.get("s3_additional_kwargs"), | ||
Config=self._transfer_config, | ||
) | ||
callback.set_size(os.path.getsize(from_file)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we need self.makedirs
here in the put_file
these days, cc @isidentical.
s3 = rem.fs | ||
s3.fs.mkdir("another/") | ||
s3 = rem.fs.s3 | ||
s3.create_bucket(Bucket="another") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The s3.fs.mkdir
was failing locally for me, though I am not sure why. I replaced this with the one that shares the intention in a better way, which passes both locally and in CI.
32c4cb3
to
9426ade
Compare
a6f21be
to
28e8ba0
Compare
def _upload( | ||
self, from_file, to_info, name=None, no_progress_bar=False, **pbar_args | ||
@staticmethod | ||
def put_file_compat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary, I'm planning to get rid of _upload
/_download
from CallbackMixin
and then this CallbackMixin
will just be a way to provide compat support for callback. Naming is bad, but will just be replace by put_file
after I get rid of _download
.
be304ff
to
07496c5
Compare
super().absolute_update(value) | ||
|
||
|
||
def tdqm_or_callback_wrapped( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This codebase is a bit weird, as we need to support both tqdm and FsspecCallback
for now.
@@ -182,9 +181,29 @@ def set_size(self, size): | |||
size = self.fs.info(self.path_info)["size"] | |||
self.progress_bar.total = size | |||
self.progress_bar.refresh() | |||
super().set_size(size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will be useful in tests, as we can introspect size and value easily.
Also removes _upload methods in other fses, and replaces them with fsspec-compatible put_file which supports fsspec callback even if they are not fsspec based filesystem.
f311ca6
to
7d3cf02
Compare
for more information, see https://pre-commit.ci
Also removes _upload methods in other fses, and replaces them
with fsspec-compatible put_file which supports fsspec callback
even if they are not fsspec based filesystem.