Commit b666f1c2 authored by Kamil Iskra's avatar Kamil Iskra

Configure perf-wrapper using the manifest

parent 1498ec1b
......@@ -17,6 +17,12 @@
"cpus": "4",
"mems": "1"
}
},
{
"name": "argo/perfwrapper",
"value": {
"enabled": "1"
}
}
]
}
......
......@@ -125,13 +125,35 @@ class Container(SpecField):
"""Load container information."""
return super(Container, self).load(data)
class PerfWrapper(SpecField):
"""Information on whether to use perf for a container."""
fields = {"enabled": spec(unicode, False)
}
def __init__(self):
"""Create empty perf wrapper."""
pass
def load(self, data):
"""Load perf wrapper information."""
ret = super(PerfWrapper, self).load(data)
if not ret:
return ret
if self.enabled not in ["0", "False", "1", "True"]:
logger.error("Invalid value of perfwrapper enabled: %s",
self.enabled)
return False
return True
class IsolatorList(SpecField):
"""Represent the list of isolator in a Manifest."""
types = {"argo/scheduler": spec(Scheduler, False),
"argo/container": spec(Container, True)
"argo/container": spec(Container, True),
"argo/perfwrapper": spec(PerfWrapper, False)
}
def __init__(self):
......
......@@ -65,6 +65,11 @@ class ContainerManager(object):
else:
argv = []
# for now we place it within the container, but it's probably better
# if it's outside (so move it to NodeOSClient?)
if hasattr(manifest.app.isolators, 'perfwrapper') and hasattr(manifest.app.isolators.perfwrapper, 'enabled') and manifest.app.isolators.perfwrapper.enabled in ["1", "True"]:
argv.append('argo-perf-wrapper')
argv.append(command)
argv.extend(args)
process = self.nodeos.execute(container_name, argv, environ)
......
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