Skip to content

Commit

Permalink
clear logs
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Aug 31, 2017
1 parent 2464ebb commit 619abaf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
6 changes: 0 additions & 6 deletions cluster/calcium/realloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ func (c *calcium) ReallocResource(ids []string, cpu float64, mem int64) (chan *t
}
}

log.Debugf("[ReallocResource] global info %v", containersInfo)
log.Debugf("[ReallocResource] cpu info %v", cpuContainersInfo)

ch := make(chan *types.ReallocResourceMessage)
go func() {
defer close(ch)
Expand Down Expand Up @@ -217,12 +214,10 @@ func (c *calcium) reallocNodesCPU(
},
}

log.Debugf("[reallocNodesCPU] Args: %v | %v | %v", nodesInfo, cpu, containersNum)
result, changed, err := c.scheduler.SelectCPUNodes(nodesInfo, cpu, containersNum)
if err != nil {
return nil, err
}
log.Debugf("[reallocNodesCPU] result: %v changed %v", result, changed)

nodeCPUMap, isChanged := changed[node.Name]
containersCPUMap, hasResult := result[node.Name]
Expand Down Expand Up @@ -253,7 +248,6 @@ func (c *calcium) reallocContainersWithCPUPrior(
log.Errorf("[realloc] realloc cpu resource failed %v", err)
return
}
log.Debugf("[reallocContainersWithCPUPrior] new nodesCPUMap %v", nodesCPUMap)

// 不并发操作了
for cpu, nodesCPUResult := range nodesCPUMap {
Expand Down
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,19 @@ func serve() {
go grpcServer.Serve(s)
go http.ListenAndServe(":46656", nil)

log.Info("Cluster started successfully.")
log.Info("[main] Cluster started successfully.")

// wait for unix signals and try to GracefulStop
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGHUP, syscall.SIGTERM)
<-sigs
sig := <-sigs
log.Infof("[main] Get signal %v.", sig)
grpcServer.GracefulStop()
log.Info("gRPC server gracefully stopped.")
log.Info("[main] gRPC server gracefully stopped.")

log.Info("Now check if cluster still have running tasks...")
log.Info("[main] Check if cluster still have running tasks.")
vibranium.Wait()
log.Info("cluster gracefully stopped.")
log.Info("[main] cluster gracefully stopped.")
}

func main() {
Expand Down
5 changes: 3 additions & 2 deletions scheduler/complex/potassium.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (m *potassium) RandomNode(nodes map[string]types.CPUMap) (string, error) {
}

func (m *potassium) SelectMemoryNodes(nodesInfo []types.NodeInfo, rate, memory int64, need int) ([]types.NodeInfo, error) {
log.Debugf("[SelectMemoryNodes] Args nodesInfo: %v, rate: %d, memory: %d, need: %d", nodesInfo, rate, memory, need)
log.Debugf("[SelectMemoryNodes] nodesInfo: %v, rate: %d, memory: %d, need: %d", nodesInfo, rate, memory, need)

p := -1
for i, nodeInfo := range nodesInfo {
Expand Down Expand Up @@ -82,6 +82,7 @@ func (m *potassium) SelectMemoryNodes(nodesInfo []types.NodeInfo, rate, memory i
}

func (m *potassium) SelectCPUNodes(nodesInfo []types.NodeInfo, quota float64, need int) (map[string][]types.CPUMap, map[string]types.CPUMap, error) {
log.Debugf("[SelectCPUNodes] nodesInfo: %v, cpu: %v, need: %v", nodesInfo, quota, need)
result := make(map[string][]types.CPUMap)
changed := make(map[string]types.CPUMap)

Expand Down Expand Up @@ -111,6 +112,6 @@ func (m *potassium) SelectCPUNodes(nodesInfo []types.NodeInfo, quota float64, ne
}
changed[selectedNode.Name] = selectedNode.CpuMap
}

log.Debugf("[SelectCPUNodes] result: %v changed %v", result, changed)
return result, changed, nil
}

0 comments on commit 619abaf

Please sign in to comment.