Skip to content

Commit

Permalink
printing
Browse files Browse the repository at this point in the history
  • Loading branch information
trevleon committed Jun 2, 2024
1 parent ade9747 commit 0a8c589
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion go/cmd/globalscheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type ObjClient interface {


func (s *server) Heartbeat(ctx context.Context, req *pb.HeartbeatRequest ) (*pb.StatusResponse, error) {
// log.Printf("heartbeat from %v", req.NodeId)
log.Printf("heartbeat from %v", req.NodeId)
mu.Lock()
s.status[req.NodeId] = HeartbeatEntry{timeReceived: time.Now(), numRunningTasks: req.RunningTasks, numQueuedTasks: req.QueuedTasks, avgRunningTime: req.AvgRunningTime, avgBandwidth: req.AvgBandwidth}
mu.Unlock()
Expand All @@ -87,7 +87,14 @@ func (s *server) LiveNodesHeartbeat(ctx context.Context) (error) {
func(s *server) SendLiveNodes(ctx context.Context) (error) {
liveNodes := make(map[uint64]bool)
for uid, heartbeat := range s.status {

liveNodes[uid] = time.Since(heartbeat.timeReceived) < LIVE_NODE_TIMEOUT
if _, val := liveNodes[uid]; val {
log.Printf("%v sent as live", req.NodeId)
}
else {
log.Printf("%v sent as dead", req.NodeId)
}
}
s.gcsClient.RegisterLiveNodes(ctx, &pb.LiveNodesRequest{LiveNodes: liveNodes})
return nil
Expand Down

0 comments on commit 0a8c589

Please sign in to comment.