-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
rust: add gRPC reflection support #4870
Conversation
Summary: The [`tonic-reflection`] crate implements the gRPC reflection protocol, and will enable us to significantly simplify `grpc_cli` usage. Reflection was released in Tonic v0.4.1, so this patch also upgrades the rest of our Tonic stack to the latest versions. Test Plan: It builds: `bazel build //tensorboard/data/server/cargo:tonic_reflection`. wchargin-branch: rust-dep-tonic-reflection wchargin-source: 2a449d629fc231d697c82171c413000f1f09e645
Summary: Thanks to hyperium/tonic#165, RustBoard development just got easier. The data server now exposes a gRPC reflection service, so you can invoke `grpc_cli` without configuring a finicky symlink tree of proto sources. Due to an upstream `rules_rust` issue, this breaks the Rustdoc server. This is unfortunate, but `cargo doc` still works as a workaround, so I don’t consider it blocking. See: <bazelbuild/rules_rust#689>. Test Plan: Launch the data server, then point `grpc_cli` at it: ``` $ bazel run //tensorboard/data/server -- --logdir ~/tensorboard_data/mnist/ & [1] 986254 listening on [::1]:6806 $ grpc_cli ls localhost:6806 tensorboard.data.TensorBoardDataProvider grpc.reflection.v1alpha.ServerReflection $ grpc_cli call localhost:6806 ListRuns 'experiment_id: "123"' connecting to localhost:6806 Received initial metadata from server: date : Wed, 14 Apr 2021 21:05:09 GMT runs { name: "lr_1E-03,conv=1,fc=2" start_time: 1563406327 } runs { name: "lr_1E-03,conv=2,fc=2" start_time: 1563406405 } runs { name: "lr_1E-04,conv=1,fc=2" start_time: 1563406522 } runs { name: "lr_1E-04,conv=2,fc=2" start_time: 1563406600 } Rpc succeeded with OK status ``` wchargin-branch: rust-grpc-reflection wchargin-source: 72b0a45f3b953ed7946d62b93a9ed36c2aad6e52
# Source files with Rust protobuf bindings. These are automatically | ||
# materialized in the source tree from the generated bindings by the | ||
# `:update_protos` script, and kept in sync via `:update_protos_test`. These | ||
# don't match the raw generated code exactly: e.g., we add license headers. | ||
_checked_in_proto_files = ["%s.pb.rs" % pkg for pkg in _proto_packages] | ||
|
||
_checked_in_file_descriptor_set = "descriptor.bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amusingly, this binary file passes the license check because it embeds
the TensorFlow licenses that appear in comments in some of the proto
files. I thus haven’t changed license_test.sh
, but can add an explicit
exemption for *.bin
if we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh. But yes, I'd prefer the explicit exemption for the sake of whoever might be around in the future if this stops passing the license test someday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Done.
wchargin-branch: rust-grpc-reflection wchargin-source: 1ce05c007074898f6f24d2a1665ddb9c866b5ddd
# Source files with Rust protobuf bindings. These are automatically | ||
# materialized in the source tree from the generated bindings by the | ||
# `:update_protos` script, and kept in sync via `:update_protos_test`. These | ||
# don't match the raw generated code exactly: e.g., we add license headers. | ||
_checked_in_proto_files = ["%s.pb.rs" % pkg for pkg in _proto_packages] | ||
|
||
_checked_in_file_descriptor_set = "descriptor.bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh. But yes, I'd prefer the explicit exemption for the sake of whoever might be around in the future if this stops passing the license test someday.
tensorboard/data/server/BUILD
Outdated
args = ["--check"] + _proto_packages, | ||
data = _genproto_files + glob(_checked_in_proto_files), | ||
args = ["--check"] + _proto_packages + ["descriptor.bin"], | ||
data = _genproto_files + glob(_checked_in_proto_files) + [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does _checked_in_proto_files
actually need to be a glob? It looks like just a literal list of filenames.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, indeed not. Done.
wchargin-branch: rust-grpc-reflection wchargin-source: 4f81bbe9bac55e01e3fe141f38711599c8da98a2 # Conflicts: # tensorboard/data/server/Cargo.toml
wchargin-branch: rust-grpc-reflection wchargin-source: 4f81bbe9bac55e01e3fe141f38711599c8da98a2
…xemption] wchargin-branch: rust-grpc-reflection wchargin-source: ff766710e91c3982212561f9f362a89e5f6ee15b
Summary:
Thanks to hyperium/tonic#165, RustBoard development just got easier.
The data server now exposes a gRPC reflection service, so you can invoke
grpc_cli
without configuring a finicky symlink tree of proto sources.Due to an upstream
rules_rust
issue, this breaks the Rustdoc server.This is unfortunate, but
cargo doc
still works as a workaround, soI don’t consider it blocking. See:
bazelbuild/rules_rust#689.
Test Plan:
Launch the data server, then point
grpc_cli
at it:wchargin-branch: rust-grpc-reflection