Skip to content

http: general enhancements #731

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

Merged
merged 16 commits into from
Aug 31, 2021
Merged

Conversation

isidentical
Copy link
Member

@isidentical isidentical commented Aug 23, 2021

TODO:

  • add tests
  • add docs

@isidentical isidentical marked this pull request as ready for review August 29, 2021 19:56
@martindurant
Copy link
Member

Sorry I didn't comment yet. I can look in detail, but currently test_entry_points_registered_on_import is failing in py36/37

@isidentical
Copy link
Member Author

Ah, didnt notice that. Seems irrelevant though

@isidentical
Copy link
Member Author

Oh, you already fixed, nvm.

Copy link
Member

@martindurant martindurant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like what's here, but have some comments.

kw = self.kwargs.copy()
kw.update(kwargs)
logger.debug(rpath)
session = await self.set_session()
async with session.get(rpath, **self.kwargs) as r:
try:
size = int(r.headers["content-length"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the chances of this being wrong due to transfer compression? (_file_info has head["Accept-Encoding"] = "identity")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm, not sure. This seemed like the easiest way to predict the general length, though there might certainly some catches about it. Do you have other suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the purpose is to report on the transfer, then I suppose it's not important - but the number of bytes written to disk won't match. I don't know if aiohttp makes available the actual number of bytes read on the stream before decompression (probably no).

@isidentical
Copy link
Member Author

Thanks for the review @martindurant, all should be addressed now!

@martindurant
Copy link
Member

Thanks for making HTTP r/w! Maybe the File object can be made writable too (with the limitation of being able to PUT the file in one call!). We'll see if the file size for the callback ends up being a problem.

@martindurant martindurant merged commit 9832691 into fsspec:master Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants