Skip to content

Add GCS handler - #10

Open
Darktex wants to merge 4 commits into
facebookresearch:mainfrom
Darktex:add-gcs
Open

Darktex wants to merge 4 commits into
facebookresearch:mainfrom
Darktex:add-gcs

Conversation

@Darktex

@Darktex Darktex commented Dec 8, 2021

Copy link
Copy Markdown

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 thread iopath/common/gcs.py Outdated
Comment on lines +261 to +263
if "r" in mode:
local_path = self._get_local_path(path)
return open(local_path, mode)

Copy link
Copy Markdown
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

Darktex commented Dec 12, 2022

Copy link
Copy Markdown
Author

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