Commit 7f94d98b authored by Sridutt Bhalachandra's avatar Sridutt Bhalachandra

[Feature] Added parameters to manifest file

Added damper and slowdown parameters to manifest file that can be used to
initiliaze power policy parameters

See Issue #10
parent 65ec78a7
......@@ -28,7 +28,9 @@
"name": "argo/powerpolicy",
"value": {
"enabled": "0",
"policy": "NONE"
"policy": "NONE",
"damper": "0.1",
"slowdown": "1.1"
}
}
]
......
......@@ -156,7 +156,9 @@ class PowerPolicy(SpecField):
policies = ['NONE', 'DDCM', 'DVFS', 'COMBINED']
fields = {"enabled": spec(unicode, False),
"policy": spec(unicode, False)
"policy": spec(unicode, False),
"damper": spec(unicode, False),
"slowdown": spec(unicode, False)
}
def __init__(self):
......@@ -176,6 +178,14 @@ class PowerPolicy(SpecField):
logger.error("Invalid value of powerpolicy policy: %s",
self.policy)
return False
if self.damper < 0.0:
logger.error("Invalid value of powerpolicy damper: %s",
self.policy)
return False
if self.slowdown < 1.0:
logger.error("Invalid value of powerpolicy slowdown: %s",
self.policy)
return False
return True
......
......@@ -50,8 +50,6 @@ class ContainerManager(object):
environ['AC_APP_NAME'] = manifest.name
environ['AC_METADATA_URL'] = "localhost"
logger.info("run: environ: %r", environ)
# TODO: Application library to load must be set during configuration
applicationpreloadlibrary = '.so'
# create container
container_name = request['uuid']
......@@ -60,6 +58,14 @@ class ContainerManager(object):
self.nodeos.create(container_name, allocation)
logger.info("created container %s", container_name)
# Container power policy information
container_powerpolicy = dict()
container_powerpolicy['policy'] = None
container_powerpolicy['damper'] = None
container_powerpolicy['slowdown'] = None
# TODO: Application library to load must be set during configuration
applicationpreloadlibrary = ''
# run my command
if hasattr(manifest.app.isolators, 'scheduler'):
sched = manifest.app.isolators.scheduler
......@@ -78,9 +84,13 @@ class ContainerManager(object):
if hasattr(manifest.app.isolators, 'powerpolicy'):
if hasattr(manifest.app.isolators.powerpolicy, 'enabled'):
if manifest.app.isolators.powerpolicy.enabled in ["1", "True"]:
if manifest.app.isolators.powerpolicy.policy != "NONE":
environ['LD_PRELOAD'] = applicationpreloadlibrary
pp = manifest.app.isolators.powerpolicy
if pp.enabled in ["1", "True"]:
if pp.policy != "NONE":
container_powerpolicy['policy'] = pp.policy
container_powerpolicy['damper'] = pp.damper
container_powerpolicy['slowdown'] = pp.slowdown
environ['LD_PRELOAD'] = applicationpreloadlibrary
argv.append(command)
argv.extend(args)
......
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