make the load average test a function of the number of processors

This commit is contained in:
Mike Bonnet 2009-02-16 18:56:29 -05:00
parent 88b5f07449
commit 0552072802

View file

@ -1185,10 +1185,11 @@ class TaskManager(object):
# checkSpace() does its own logging
return False
loadavgs = os.getloadavg()
#XXX - this value is pretty arbitrary, maybe it make it
# a function of the number of cpus?
if loadavgs[0] > 8.0:
self.status = "Load average > 8.0"
# this likely treats HT processors the same as real ones
# but that's fine, it's a conservative test
maxload = 4.0 * os.sysconf('SC_NPROCESSORS_ONLN')
if loadavgs[0] > maxload:
self.status = "Load average %.2f > %.2f" % (loadavgs[0], maxload)
self.logger.info(self.status)
return False
#XXX - add more checks