working worker

This commit is contained in:
Barak Michener 2020-12-04 20:01:46 +00:00
parent 46524832de
commit 51f92278ac
9 changed files with 194 additions and 61 deletions

13
main.go
View file

@ -8,13 +8,14 @@ import (
"os"
"github.com/barakmich/go_raylet/ray_rpc"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/grpclog"
)
var (
gRPCPort = flag.Int("grpc-port", 50000, "The gRPC server port")
gRPCPort = flag.Int("grpc-port", 50050, "The gRPC server port")
httpPort = flag.Int("http-port", 8080, "The HTTP server port")
)
@ -27,10 +28,12 @@ func init() {
func main() {
flag.Parse()
logger, _ := zap.NewDevelopment()
zap.ReplaceGlobals(logger)
addr := fmt.Sprintf("0.0.0.0:%d", *gRPCPort)
lis, err := net.Listen("tcp", addr)
if err != nil {
log.Fatalln("Failed to listen:", err)
logger.Fatal("Failed to listen:", zap.Error(err))
}
s := grpc.NewServer(
grpc.Creds(insecure.NewCredentials()),
@ -40,8 +43,6 @@ func main() {
ray_rpc.RegisterRayletWorkerConnectionServer(s, server)
// Serve gRPC Server
log.Info("Serving gRPC on https://", addr)
go func() {
log.Fatal(s.Serve(lis))
}()
fmt.Println("Serving gRPC on https://", addr)
s.Serve(lis)
}