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

Replace gRPC code generation tool from Znly/protoc to Buf #2295

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/db-manager/v1beta1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const (
var dbIf common.KatibDBInterface

type server struct {
health_pb.HealthServer
api_pb.DBManagerServer
}

// Report a log of Observations for a Trial.
Expand Down
4 changes: 3 additions & 1 deletion cmd/suggestion/goptuna/v1beta1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
)

type healthService struct {
health_pb.HealthServer
}

func (s *healthService) Check(ctx context.Context, in *health_pb.HealthCheckRequest) (*health_pb.HealthCheckResponse, error) {
Expand All @@ -46,7 +47,8 @@ func main() {
klog.Fatalf("Failed to listen: %v", err)
}
srv := grpc.NewServer()
api_v1_beta1.RegisterSuggestionServer(srv, suggestion.NewSuggestionService())
api_v1_beta1.RegisterSuggestionServer(srv, &suggestion.SuggestionService{}) // Updated code

health_pb.RegisterHealthServer(srv, &healthService{})

klog.Infof("Start Goptuna suggestion service: %s", address)
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/manager/health/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1
plugins:
- plugin: buf.build/protocolbuffers/python:v26.0
out: python
- plugin: buf.build/grpc/python:v1.62.1
out: python
- plugin: buf.build/protocolbuffers/go:v1.33.0
out: ./
- plugin: buf.build/grpc/go
out: ./
7 changes: 7 additions & 0 deletions pkg/apis/manager/health/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
3 changes: 1 addition & 2 deletions pkg/apis/manager/health/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ set -e
cd "$(dirname "$0")"

proto="health.proto"
docker run -i --rm -v "$PWD:$PWD" -w "$PWD" znly/protoc --python_out=plugins=grpc:./python --go_out=plugins=grpc:. -I. $proto
docker run -i --rm -v "$PWD:$PWD" -w "$PWD" znly/protoc --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin --python_out=./python --grpc_out=./python -I. $proto
buf generate --template=buf.gen.yaml $proto
Loading
Loading