52 |
52 |
, optInstSet = False
|
53 |
53 |
, optMaxLength = -1
|
54 |
54 |
, optMaster = ""
|
55 |
|
, optVerbose = 0
|
|
55 |
, optVerbose = 1
|
56 |
56 |
, optOffline = []
|
57 |
57 |
, optMinScore = 1e-9
|
58 |
58 |
, optShowVer = False
|
... | ... | |
90 |
90 |
, Option ['v'] ["verbose"]
|
91 |
91 |
(NoArg (\ opts -> opts { optVerbose = (optVerbose opts) + 1 }))
|
92 |
92 |
"increase the verbosity level"
|
|
93 |
, Option ['q'] ["quiet"]
|
|
94 |
(NoArg (\ opts -> opts { optVerbose = (optVerbose opts) - 1 }))
|
|
95 |
"decrease the verbosity level"
|
93 |
96 |
, Option ['O'] ["offline"]
|
94 |
97 |
(ReqArg (\ n opts -> opts { optOffline = n:optOffline opts }) "NODE")
|
95 |
98 |
" set node as offline"
|
... | ... | |
186 |
189 |
(loaded_nl, il, csf, ktn, kti) <- liftM2 Cluster.loadData node_data inst_data
|
187 |
190 |
let (fix_msgs, fixed_nl) = Cluster.checkData loaded_nl il ktn kti
|
188 |
191 |
|
189 |
|
unless (null fix_msgs) $ do
|
|
192 |
unless (null fix_msgs || verbose == 0) $ do
|
190 |
193 |
putStrLn "Warning: cluster has inconsistent data:"
|
191 |
194 |
putStrLn . unlines . map (\s -> printf " - %s" s) $ fix_msgs
|
192 |
195 |
|
... | ... | |
217 |
220 |
(Container.size nl)
|
218 |
221 |
(Container.size il)
|
219 |
222 |
|
220 |
|
when (length csf > 0 && not oneline && verbose > 0) $ do
|
|
223 |
when (length csf > 0 && not oneline && verbose > 1) $ do
|
221 |
224 |
printf "Note: Stripping common suffix of '%s' from names\n" csf
|
222 |
225 |
|
223 |
226 |
let (bad_nodes, bad_instances) = Cluster.computeBadItems nl il
|
... | ... | |
246 |
249 |
ini_cv min_cv)
|
247 |
250 |
exitWith ExitSuccess
|
248 |
251 |
|
249 |
|
unless oneline (if verbose > 1 then
|
|
252 |
unless oneline (if verbose > 2 then
|
250 |
253 |
printf "Initial coefficients: overall %.8f, %s\n"
|
251 |
254 |
ini_cv (Cluster.printStats nl)
|
252 |
255 |
else
|
... | ... | |
263 |
266 |
ord_plc = reverse fin_plc
|
264 |
267 |
sol_msg = if null fin_plc
|
265 |
268 |
then printf "No solution found\n"
|
266 |
|
else (if verbose > 1
|
|
269 |
else (if verbose > 2
|
267 |
270 |
then printf "Final coefficients: overall %.8f, %s\n"
|
268 |
271 |
fin_cv (Cluster.printStats fin_nl)
|
269 |
272 |
else printf "Cluster score improved from %.8f to %.8f\n"
|
... | ... | |
297 |
300 |
putStrLn ""
|
298 |
301 |
putStrLn "Final cluster status:"
|
299 |
302 |
putStrLn $ Cluster.printNodes ktn fin_nl
|
300 |
|
when (verbose > 2) $
|
|
303 |
when (verbose > 3) $
|
301 |
304 |
do
|
302 |
305 |
printf "Original: mem=%d disk=%d\n" orig_mem orig_disk
|
303 |
306 |
printf "Final: mem=%d disk=%d\n" final_mem final_disk
|