rust: add GCS listing and reading #4645
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This patch implements the extent of the Google Cloud Storage protocol
that TensorBoard needs: list objects in a bucket with a given prefix,
and read partial contents of an object. It turns out to be really easy.
For comparison, TensorFlow also rolls its own GCS client. Theirs
is more complex because it needs to handle writable files and support
general-purpose caching patterns. By contrast, we have a simple one-pass
read pattern and already assume that files are append-only, so we avoid
both the complexity and pathological interactions like #1225.
For now, this only serves public buckets and objects. Authentication is
also easy (and doesn’t require crypto or anything complicated), but, for
ease of review, we defer it to a future patch.
Test Plan:
Included a simple client that supports
gsutil ls
andgsutil cat
. Runwith
RUST_LOG=debug cargo run --release --bin gsutil
and more args:ls tensorboard-bench-logs
to list all 33K objects in the bucket,across 34 pages of list operations (3.3s on my machine);
ls tensorboard-bench-logs --prefix mnist/
to list just a singlelogdir, which should be much faster (0.1 seconds on my machine,
which includes setting up the keep-alive connection);
ls tensorboard-bench-logs --prefix nopenope/
to check the casewhere there are no matching results;
cat tensorboard-bench-logs mnist/README --to=11
to print the first12 bytes (
Range: bytes=0-11
inclusive) of an object;cat tensorboard-bench-logs mnist/README --from=9999
to printnothing, since the object is shorter than 9999 bytes.
wchargin-branch: rust-gcs-client