Commit 89148476 authored by Sridutt Bhalachandra's avatar Sridutt Bhalachandra
Browse files

Added damper and slowdown parameters of power policy to manifest file

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

See Issue #10
parent 3a52922c
......@@ -27,8 +27,10 @@
{
"name": "argo/powerpolicy",
"value": {
"enabled": "0",
"policy": "NONE"
"enabled": "0",
"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
......@@ -79,7 +85,16 @@ 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":
container_powerpolicy['policy'] = (
manifest.app.isolators.powerpolicy.policy
)
if container_powerpolicy['policy'] != "NONE":
container_powerpolicy['damper'] = (
manifest.app.isolators.powerpolicy.damper
)
container_powerpolicy['slowdown'] = (
manifest.app.isolators.powerpolicy.slowdown
)
environ['LD_PRELOAD'] = applicationpreloadlibrary
argv.append(command)
......
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