(workerIP string, m *rpc.ReduceInfo)
| 30 | } |
| 31 | |
| 32 | func Reduce(workerIP string, m *rpc.ReduceInfo) bool { |
| 33 | conn, err := grpc.Dial(workerIP, grpc.WithInsecure()) |
| 34 | if err != nil { |
| 35 | log.Warn(err) |
| 36 | return false |
| 37 | } |
| 38 | defer conn.Close() |
| 39 | c := rpc.NewWorkerClient(conn) |
| 40 | |
| 41 | ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) |
| 42 | defer cancel() |
| 43 | |
| 44 | r, err := c.Reduce(ctx, m) |
| 45 | if err != nil { |
| 46 | log.Warn("[Master]: " + err.Error()) |
| 47 | return false |
| 48 | } |
| 49 | return r.Result |
| 50 | } |
| 51 | |
| 52 | func End(workerIP string) bool { |
| 53 | conn, err := grpc.Dial(workerIP, grpc.WithInsecure()) |
no test coverage detected