Commit b6798623 authored by Swann Perarnau's avatar Swann Perarnau

[fix] Fix power management to make it work on knl

Small fixes to correct for wrong actions on power control over a real
load.
parent 2bfab2b0
......@@ -45,8 +45,8 @@ class ContainerManager(object):
# build context to execute
environ = os.environ
environ['PATH'] = ("/usr/local/sbin:"
"/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
# environ['PATH'] = ("/usr/local/sbin:"
# "/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
environ['AC_APP_NAME'] = manifest.name
environ['AC_METADATA_URL'] = "localhost"
logger.info("run: environ: %r", environ)
......
......@@ -65,16 +65,16 @@ class PowerActuator(object):
logger.info("power limits: %r:", pl)
if target == 'i':
for k in pl:
r = range(int(pl[k]['curW']), int(pl[k]['maxW']))
r = range(int(pl[k]['curW'])+1, int(pl[k]['maxW']))
actions.extend([Action(k, s, s - r[0]) for s in r])
elif target == 'd':
for k in pl:
r = range(0, int(pl[k]['curW']))
actions.extend([Action(k, s, s - r[-1]) for s in r])
r = range(1, int(pl[k]['curW']))
actions.extend([Action(k, s, r[-1] - s) for s in r])
return actions
def execute(self, action):
logger.info("changing power limit: %r", action)
logger.info("changing power limit: %r, %r", action.command, action.delta)
self.sensor_manager.set_powerlimit(action.target, action.command)
def update(self, action):
......@@ -105,7 +105,7 @@ class Controller(object):
if actions:
# TODO: better choice
actions.sort(key=lambda x: x[0].delta)
return actions.pop()
return actions.pop(0)
else:
return (None, None)
......
......@@ -19,7 +19,7 @@ logger = logging.getLogger('nrm')
class Daemon(object):
def __init__(self):
self.target = 1.0
self.target = 100.0
def do_downstream_receive(self, parts):
logger.info("receiving downstream message: %r", parts)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment