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

cat with start/stop ranges #744

Merged
merged 13 commits into from
Sep 21, 2021
Merged

Conversation

martindurant
Copy link
Member

No description provided.

@martindurant
Copy link
Member Author

cc @rjzamora @jrbourbeau

The idea is to use the max_gap arg to decide whether to merge bytes ranges for the same file:

  • if None, don't do any merging
  • if 0, merge overlaps and contiguous pieces
  • is >0, merge pieces where the gap is smaller than this number. Maybe should consider the maximum size of the request, but I would say no.

@martindurant martindurant changed the title start cat with start/stop ranges Sep 8, 2021
class KnownPartsOfAFile(BaseCache):
name = "parts"

def __init__(self, blocksize, fetcher, size, data={}, **_):
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like you are assuming that the user has already read the necessary byte ranges from the file and has used them to populate the values of data before the file is open and this cache is initialized. Am I mistaken?

To clarify, I want to make sure that we can specify only the known byte ranges (not the actual data stored at those byte ranges) when we call fs.open. I would expect the necessary byte ranges to be fetched automatically from the file (using cat_ranges) when this cache is initialized. Does that make sense, or am I misunderstanding the API?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes you have it right, the API as I have it here expects the data to be delivered by the caller. I could do as you suggest, and have the class fetch the ranges at instantiation, but fetcher here is not in general (or ever?) asynchronous, and in any case, we expect the reads may come from several files at once. I see your point, though, it would fit better with the current shape of the other cache classes.

@martindurant martindurant marked this pull request as ready for review September 21, 2021 16:50
Martin Durant added 3 commits September 21, 2021 13:05
(since parts cache cannot fetch)
@martindurant martindurant merged commit 04636c2 into fsspec:master Sep 21, 2021
@martindurant
Copy link
Member Author

@rjzamora , as agreed. We can iterate on this yet, since it's not very prominent in the API.

@martindurant martindurant deleted the cat-ranges branch September 21, 2021 18:37
@rjzamora
Copy link
Contributor

I'll be happy to help add the necessary logic to leverage these new features in Dask once dask#8072 gets in.

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