Skip to content
Snippets Groups Projects
Commit 16103319 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix score calculation to work with empty clusters

Currently the cluster score calculation includes an offline instance
percentage, expressed as “offline inst / (offline + online inst)”, which
results in NaN for empty clusters. This patch changes the calculation
such that clusters with no offline instances (this criteria includes
completely empty clusters) get a score of zero on this component of the
total score.
parent dca7f396
No related branches found
No related tags found
No related merge requests found
......@@ -176,8 +176,10 @@ compDetailedCV nl =
(length . Node.slist $ n)) $ offline
online_inst = sum . map (\n -> (length . Node.plist $ n) +
(length . Node.slist $ n)) $ nodes
off_score = fromIntegral offline_inst /
fromIntegral (online_inst + offline_inst)::Double
off_score = if offline_inst == 0
then 0::Double
else fromIntegral offline_inst /
fromIntegral (offline_inst + online_inst)::Double
cpu_l = map Node.p_cpu nodes
cpu_cv = varianceCoeff cpu_l
in (mem_cv, dsk_cv, n1_score, res_cv, off_score, cpu_cv)
......
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