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

Use aiofiles to avoid blocking file functions #407

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mmourafiq
Copy link
Contributor

@mmourafiq mmourafiq commented Aug 21, 2021

related #405

@martindurant
Copy link
Member

I thought perhaps someone other than me might have some opinions here. I'm not certain gcsfs (or any of the fsspec async implementations) wants to take on the extra dependency. It seems unlikely to me that latency in the local filesystem will ever be important compared to waiting on the network.

Furthermore, and I might be wrong here, but my impression is that file calls are fundamentally blocking, and aiofiles (and friends) emulate async by dispatching to threads.

@tasansal
Copy link
Contributor

tasansal commented Jan 9, 2024

First things first, don't aiofiles apply to local files? gcsfs is used for remote files on Google Cloud Storage, so wouldn't it make sense to think about this in the fsspec local file context?

Besides that, I agree with @martindurant on being unnecessary for local disk + local files in sync applications. However, having coroutines for file operations using aiofiles may be useful in async app cases and will make it more convenient for downstream developers (i.e. fastapi app using a local file as a cache via fsspec and also using gcsfs to access the cloud storage, with the same non-blocking async APIs).

@tasansal
Copy link
Contributor

tasansal commented Jan 9, 2024

P.S. I am a little confused. This PR shows up in gcsfs; however, it is merging into fsspec, but editing gcsfs code.

@martindurant
Copy link
Member

it is merging into fsspec, but editing gcsfs code.

Here, fsspec is the org, so it means merging into fsspec/gcsfs:main

@tasansal
Copy link
Contributor

tasansal commented Jan 9, 2024

it is merging into fsspec, but editing gcsfs code.

Here, fsspec is the org, so it means merging into fsspec/gcsfs:main

Ah I see. It seems like PRs from forks do that. Learn something new everyday :)

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.

3 participants