MCPcopy Create free account
hub / github.com/BWbwchen/MapReduce / Health

Function Health

master/rpcClient.go:69–88  ·  view source on GitHub ↗
(workerIP string)

Source from the content-addressed store, hash-verified

67}
68
69func Health(workerIP string) int {
70 conn, err := grpc.Dial(workerIP, grpc.WithInsecure())
71 if err != nil {
72 log.Warn(err)
73 return int(WORKER_UNKNOWN)
74 }
75 defer conn.Close()
76 c := rpc.NewWorkerClient(conn)
77
78 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Millisecond)
79 defer cancel()
80
81 r, err := c.Health(ctx, &rpc.Empty{})
82 if err != nil {
83 return int(WORKER_UNKNOWN)
84 }
85
86 log.Info("[Master] Worker State ", int(r.State))
87 return int(r.State)
88}

Callers

nothing calls this directly

Calls 2

HealthMethod · 0.95
NewWorkerClientFunction · 0.92

Tested by

no test coverage detected