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

Add GCS handler #10

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add GCS handler #10

wants to merge 4 commits into from

Conversation

Darktex
Copy link

@Darktex Darktex commented Dec 8, 2021

Summary

Adds a GCS file handler, similar to one in S3.

Test plan

Wrote a test for it, and ran it on my setup. I also used this in a multi-threaded environment with torch DDP and indeed it works :)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 8, 2021
Comment on lines 261 to 263
if "r" in mode:
local_path = self._get_local_path(path)
return open(local_path, mode)
Copy link
Contributor

Choose a reason for hiding this comment

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

It should use blob.open instead of caching. Caching has the side effect that it may fill up the disk space, so it's not a good idea to transparently apply caching when reading. Instead, users should explicit call for caching if needed, by using get_local_path.

We apply this strategy to some internal storage backends as well.

@Darktex
Copy link
Author

Darktex commented Dec 12, 2022

I ended up using a fork and de-prioritizing making this PR, but we have been using this code for months and I figured I'd finish this PR to share it with everyone else :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants