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