bug fix: numpy mean nan warning

This commit is contained in:
mantaohuang 2020-07-28 19:19:16 -04:00
parent d4f444940c
commit 783b8bef8c

View File

@ -120,6 +120,12 @@ class OManager:
value = float(value)
ping_tas.add(time, value)
def io_mean(x):
if len(x):
return numpy.mean(x)
else:
return numpy.nan
def ping_mean(x):
x = numpy.array(x)
x = x[x > 0]
@ -274,6 +280,10 @@ class OManager:
# n_down = 2
weights = []
for i in self.instances:
if i["op"].status != RUNNING:
i["weight"] = 0
weights.append(i["weight"])
continue
n_up = i["op"].n_up
n_down = i["op"].n_down
ping_stat = i["op"].get_ping_stat(lines=max(n_up, n_down))