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

refresh = True should be the default for GCSFS.ls #647

Open
rickmcgeer opened this issue Nov 9, 2024 · 6 comments
Open

refresh = True should be the default for GCSFS.ls #647

rickmcgeer opened this issue Nov 9, 2024 · 6 comments

Comments

@rickmcgeer
Copy link

I was working with this system today, and noticed that ls wasn't returning all the files in a bucket. After I changed the call from:

 gcs_file_system.ls(my_bucket)

To

 gcs_file_system.ls(my_bucket, refresh=True)

I can appreciate the value of caching as an option, but returning an outdated file listing doesn't match the semantics of a filesystem ls, leading to user confusion.

@martindurant
Copy link
Member

I respectfully disagree. The cost of making remote listing calls is significant, and ignoring the cache in general would result in significant performance problems for most users. Note:

  • the cache will be cleared in the correct locations following write operations, so you do not need to request a refresh unless you anticipate writes from another source during your session
  • the argument use_listings_cache can be used to turn off the cache if you wish, giving you full control for your application.

I recognise that setting the best defaults for the most people is a hard problem.

@martindurant
Copy link
Member

(you may also find the listings_expiry_time argument useful)

@rickmcgeer
Copy link
Author

rickmcgeer commented Nov 11, 2024 via email

@martindurant
Copy link
Member

Thanks, I appreciate the feedback. In fact, having just faced this question, you might be in the best place to provide this extra text. It might go in the GCSFileSystem docstring, in the gcsfs prose documentation, or over at fsspec (since the argument is shared by several filesystems).

@rickmcgeer
Copy link
Author

rickmcgeer commented Nov 12, 2024 via email

@rickmcgeer
Copy link
Author

I've forked the repo, made the changes, and filed a pull request.

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

No branches or pull requests

2 participants