(workerIP string)
| 67 | } |
| 68 | |
| 69 | func 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 | } |
nothing calls this directly
no test coverage detected