Skip to content
Snippets Groups Projects
Commit b5b19d5e authored by Agata Murawska's avatar Agata Murawska
Browse files

Small reordering and renaming in hcheck


Reordered functions and shortened one function name.

Signed-off-by: default avatarAgata Murawska <agatamurawska@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent caa97388
No related branches found
No related tags found
No related merge requests found
......@@ -85,21 +85,6 @@ data Level = GroupLvl
htcPrefix :: String
htcPrefix = "HCHECK"
-- | Phase-specific prefix for machine readable version.
phasePrefix :: Phase -> String
phasePrefix Initial = "INIT"
phasePrefix Rebalanced = "FINAL"
-- | Description of phases for human readable version.
phaseDescription :: Phase -> String
phaseDescription Initial = "initially"
phaseDescription Rebalanced = "after rebalancing"
-- | Level-specific prefix for machine readable version.
levelPrefix :: Level -> String
levelPrefix GroupLvl = "GROUP"
levelPrefix ClusterLvl = "CLUSTER"
-- | Data showed both per group and per cluster.
commonData :: [(String, String)]
commonData =[ ("N1_FAIL", "Nodes not N+1 happy")
......@@ -119,6 +104,21 @@ clusterData = commonData ++
, ("CAN_REBALANCE", "Possible to run rebalance")
]
-- | Phase-specific prefix for machine readable version.
phasePrefix :: Phase -> String
phasePrefix Initial = "INIT"
phasePrefix Rebalanced = "FINAL"
-- | Level-specific prefix for machine readable version.
levelPrefix :: Level -> String
levelPrefix GroupLvl = "GROUP"
levelPrefix ClusterLvl = "CLUSTER"
-- | Description of phases for human readable version.
phaseDescr :: Phase -> String
phaseDescr Initial = "initially"
phaseDescr Rebalanced = "after rebalancing"
-- | Format a list of key, value as a shell fragment.
printKeysHTC :: [(String, String)] -> IO ()
......@@ -156,7 +156,7 @@ printGroupStats verbose False phase grp stats score = do
unless (verbose == 0) $ do
printf "\nStatistics for group %s %s\n"
(Group.name grp) (phaseDescription phase) :: IO ()
(Group.name grp) (phaseDescr phase) :: IO ()
mapM_ (\(a,b) -> printf " %s: %s\n" (snd a) b :: IO ())
(zip groupData printstats)
......@@ -175,7 +175,7 @@ printClusterStats verbose False phase stats needrebal canrebal = do
let printstats = map (printf "%d") stats ++
map (printBool False) [needrebal, canrebal]
unless (verbose == 0) $ do
printf "\nCluster statistics %s\n" (phaseDescription phase) :: IO ()
printf "\nCluster statistics %s\n" (phaseDescr phase) :: IO ()
mapM_ (\(a,b) -> printf " %s: %s\n" (snd a) b :: IO ())
(zip clusterData printstats)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment