-filterFails :: Cluster.AllocSolution
- -> Maybe [(Node.List, Instance.Instance, [Node.Node])]
-filterFails sols =
- if null sols then Nothing -- No nodes onto which to allocate at all
- else let sols' = filter (isJust . fst3) sols
- in if null sols' then
- Nothing -- No valid allocation solutions
- else
- return $ map (\(x, y, z) -> (fromJust x, y, z)) sols'
-
-processResults :: (Monad m) => [(Node.List, Instance.Instance, [Node.Node])]
- -> m (Node.List, Instance.Instance, [Node.Node])
-processResults sols =
- let sols' = map (\e@(nl', _, _) -> (Cluster.compCV nl', e)) sols
- sols'' = sortBy (compare `on` fst) sols'
- in return $ snd $ head sols''
-
+data Phase = PInitial | PFinal
+
+statsData :: [(String, Cluster.CStats -> String)]
+statsData = [ ("SCORE", printf "%.8f" . Cluster.cs_score)
+ , ("INST_CNT", printf "%d" . Cluster.cs_ninst)
+ , ("MEM_FREE", printf "%d" . Cluster.cs_fmem)
+ , ("MEM_AVAIL", printf "%d" . Cluster.cs_amem)
+ , ("MEM_RESVD",
+ \cs -> printf "%d" (Cluster.cs_fmem cs - Cluster.cs_amem cs))
+ , ("MEM_INST", printf "%d" . Cluster.cs_imem)
+ , ("MEM_OVERHEAD",
+ \cs -> printf "%d" (Cluster.cs_xmem cs + Cluster.cs_nmem cs))
+ , ("MEM_EFF",
+ \cs -> printf "%.8f" (fromIntegral (Cluster.cs_imem cs) /
+ Cluster.cs_tmem cs))
+ , ("DSK_FREE", printf "%d" . Cluster.cs_fdsk)
+ , ("DSK_AVAIL", printf "%d ". Cluster.cs_adsk)
+ , ("DSK_RESVD",
+ \cs -> printf "%d" (Cluster.cs_fdsk cs - Cluster.cs_adsk cs))
+ , ("DSK_INST", printf "%d" . Cluster.cs_idsk)
+ , ("DSK_EFF",
+ \cs -> printf "%.8f" (fromIntegral (Cluster.cs_idsk cs) /
+ Cluster.cs_tdsk cs))
+ , ("CPU_INST", printf "%d" . Cluster.cs_icpu)
+ , ("CPU_EFF",
+ \cs -> printf "%.8f" (fromIntegral (Cluster.cs_icpu cs) /
+ Cluster.cs_tcpu cs))
+ , ("MNODE_MEM_AVAIL", printf "%d" . Cluster.cs_mmem)
+ , ("MNODE_DSK_AVAIL", printf "%d" . Cluster.cs_mdsk)
+ ]
+
+specData :: [(String, Options -> String)]
+specData = [ ("MEM", printf "%d" . optIMem)
+ , ("DSK", printf "%d" . optIDsk)
+ , ("CPU", printf "%d" . optIVCPUs)
+ , ("RQN", printf "%d" . optINodes)
+ ]
+
+clusterData :: [(String, Cluster.CStats -> String)]
+clusterData = [ ("MEM", printf "%.0f" . Cluster.cs_tmem)
+ , ("DSK", printf "%.0f" . Cluster.cs_tdsk)
+ , ("CPU", printf "%.0f" . Cluster.cs_tcpu)
+ ]
+
+-- | Recursively place instances on the cluster until we're out of space