# Faiyaz Ahmed <faiyaza@cs.princeton.edu>
# Copyright (C) 2004-2006 The Trustees of Princeton University
#
# Faiyaz Ahmed <faiyaza@cs.princeton.edu>
# Copyright (C) 2004-2006 The Trustees of Princeton University
#
# System slices that should not be reset (regexps)
system_slices = ['root', PLC_SLICE_PREFIX + '_']
# System slices that should not be reset (regexps)
system_slices = ['root', PLC_SLICE_PREFIX + '_']
- # Check to see if a slice needs to be killed. If it has rules more than kill_thresh in
- # the probation period (kill_timeout) send an email, kill the slice.
+ # Check to see if a slice needs to be killed. If it has been killed more
+ # than kill_thresh in the probation period (kill_timeout) send an email, kill the slice.
# Reset slice after checking to see if slice is out of timeout.
# Increment resetcount, check to see if larger than kill_thresh.
def reset(self, params):
# Reset slice after checking to see if slice is out of timeout.
# Increment resetcount, check to see if larger than kill_thresh.
def reset(self, params):
# and we are out of the reset timeout.
if self.resetcount == 0 or self.resettimeleft == 0:
# Do we need to kill this slice? Check history first.
# and we are out of the reset timeout.
if self.resetcount == 0 or self.resettimeleft == 0:
# Do we need to kill this slice? Check history first.
- global period, change_thresh, reset_thresh, reboot_thresh, min_thresh, system_slices
+ global period, change_thresh, reset_thresh, reboot_thresh, rss_min, system_slices
reset_thresh = int(optval)
elif opt == "--reboot-thresh":
reboot_thresh = int(optval)
reset_thresh = int(optval)
elif opt == "--reboot-thresh":
reboot_thresh = int(optval)
(version, slices) = pickle.load(f)
f.close()
# Check version of data file
(version, slices) = pickle.load(f)
f.close()
# Check version of data file
# Try and find a hog
slicelist = slices.values()
slicelist.sort(lambda a, b: b['rss'] - a['rss'])
for slice in slicelist:
percent = 100. * slice['rss'] / total_rss
# Try and find a hog
slicelist = slices.values()
slicelist.sort(lambda a, b: b['rss'] - a['rss'])
for slice in slicelist:
percent = 100. * slice['rss'] / total_rss
if not resetlist.has_key(slice['name']):
resetlist[slice['name']] = Reset(slice['name'])
resetlist[slice['name']].reset(params)
if not resetlist.has_key(slice['name']):
resetlist[slice['name']] = Reset(slice['name'])
resetlist[slice['name']].reset(params)
if used >= (last_used + change_thresh):
print "%d%% swap consumed, %d%% in last %d seconds" % \
(used, used - last_used, period - timer)
if used >= (last_used + change_thresh):
print "%d%% swap consumed, %d%% in last %d seconds" % \
(used, used - last_used, period - timer)