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

refactor(fsspec): remove upper bound on fsspec #221

Merged
merged 14 commits into from
Dec 18, 2023

Conversation

gforsyth
Copy link
Contributor

@gforsyth gforsyth commented Nov 8, 2023

We're using pins as a dependency in ibis-framework and ideally we
can remove the upper-pin on fsspec so that doesn't impact our users.
I think the usage of the moved hash_name function is the only breaking
change between the current upper pin and most recent release, so I've
added a small workaround to handle the change.

All of the local tests pass, I didn't yet set up sufficient credentials
to handle the various cloud tests.

We're using `pins` as a dependency in `ibis-framework` and ideally we
can remove the upper-pin on `fsspec` so that doesn't impact our users.
I think the usage of the moved `hash_name` function is the only breaking
change between the current upper pin and most recent release, so I've
added a small workaround to handle the change.

All of the local tests pass, I didn't yet set up sufficient credentials
to handle the various cloud tests.
@gforsyth gforsyth force-pushed the remove_fsspec_bound branch from 80a2784 to a210de5 Compare November 8, 2023 20:07
@isabelizimm
Copy link
Collaborator

isabelizimm commented Nov 13, 2023

Hi there @gforsyth -- thank you so much for the contribution! This will be great for ibis and also pins to be able to support all fsspec versions again 🤝 I just reran the CI with all the relevant secrets and am seeing some failures that, at first glance, seem unrelated to your changes. Let me do some spelunking this afternoon, then hopefully we can merge this in!

@gforsyth
Copy link
Contributor Author

Thanks for taking a look, @isabelizimm !
I haven't been able to replicate the (local) failures, but I'll also try to mess around with my environment and see if I can find out if there's some combination of dependencies that isn't being handled gracefully here.

@isabelizimm
Copy link
Collaborator

Are you able to check what version of fsspec you are testing on? Locally I'm able to hit these same errors when upgrading to the latest version, 2023.10.0. It looks like there were some changes to the way fsspec.LocalFileSystem is created, which affects how board_folder is created in pins. Specifically, there is a change in the name of the fsspec.fs.protocol used and there is no longer the attribute LocalFileSystem._check_file.

I'm happy to build off your branch and fix those pieces, if you are okay with that!

@isabelizimm
Copy link
Collaborator

isabelizimm commented Dec 12, 2023

cc: @machow have you ever seen the RecursionError: maximum recursion depth exceeded while calling a Python object error when you were in pins land? All of these tests pass/docs build locally, even with old fsspec versions 😩

I'm not wholly opposed to bumping the depth, but would like to avoid it.

@@ -57,12 +57,62 @@ def prefix_cache(fs, board_base_path):
return f"{proto_name}_{base_hash}"


class HashMapper:
Copy link
Collaborator

Choose a reason for hiding this comment

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

rather than having different classes for each cache type, we can use custom mappers

super().__init__(*args, **kwargs)
self.hash_prefix = hash_prefix
self._mapper = mapper(hash_prefix)

def hash_name(self, path, *args, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

the hash_name method is for backwards compatibility with fsspec<2023.9.0

base_name = super().hash_name(path, same_name)
suffix = Path(path).name
return f"{base_name}_{suffix}"
def hash_name(self, path, *args, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

the hash_name method is for backwards compatibility with fsspec<2023.9.0

@isabelizimm
Copy link
Collaborator

Alright, this ended up being some careful cache extraction, but it's in a good place now! Thanks @machow for the pairing sessions to help guide this through. If you have any post-merge questions/comments/concerns, let's make those a follow-up PR 🙌

@isabelizimm isabelizimm merged commit d0d1095 into rstudio:main Dec 18, 2023
24 checks passed
@PeterJCLaw PeterJCLaw mentioned this pull request Jan 3, 2024
@gforsyth gforsyth deleted the remove_fsspec_bound branch July 10, 2024 16:29
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