diff options
author | Clark Williams <williams@redhat.com> | 2015-06-08 14:36:39 -0500 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2015-06-10 11:44:38 -0500 |
commit | f1c7a8d55cdc5a796887da1da59ba7719a17f618 (patch) | |
tree | 6711537adf930ceab719d9cc776607b04caab670 | |
parent | a072586592bbf50d615e097affc4372045874d1c (diff) | |
download | rteval-f1c7a8d55cdc5a796887da1da59ba7719a17f618.tar.gz |
modules: add group cpulist parameter to modules
Add a cpulist paramter to load and measurement groups for use in
setting affinity in both loads and measurement modules.
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | rteval/modules/__init__.py | 8 | ||||
-rw-r--r-- | rteval/modules/loads/__init__.py | 4 | ||||
-rw-r--r-- | rteval/modules/measurement/__init__.py | 3 |
3 files changed, 14 insertions, 1 deletions
diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py index de70e03..cad593c 100644 --- a/rteval/modules/__init__.py +++ b/rteval/modules/__init__.py @@ -229,6 +229,7 @@ objects during module import.""" raise TypeError("logger attribute is not a Log() object") self.__modules_root = modules_root + self.__modtype = modules_root.split('.')[-1] self.__logger = logger self.__modobjects = {} # Keeps track of instantiated objects self.__modsloaded = {} # Keeps track of imported modules @@ -267,6 +268,13 @@ the information provided by the module""" def SetupModuleOptions(self, parser, config): """Sets up a separate optptarse OptionGroup per module with its supported parameters""" + grparser = optparse.OptionGroup(parser, "Group Options for %s modules" % self.__modtype) + grparser.add_option('--%s-cpulist' % self.__modtype, + dest='%s___cpulist' % self.__modtype, action='store', + help='CPU list where %s modules will run' % self.__modtype, + metavar='LIST') + parser.add_option_group(grparser) + for (modname, mod) in self.__modsloaded.items(): opts = mod.ModuleParameters() if len(opts) == 0: diff --git a/rteval/modules/loads/__init__.py b/rteval/modules/loads/__init__.py index 724ebef..29754c6 100644 --- a/rteval/modules/loads/__init__.py +++ b/rteval/modules/loads/__init__.py @@ -50,6 +50,7 @@ class LoadThread(rtevalModulePrototype): self.source = config.setdefault('source', None) self.reportdir = config.setdefault('reportdir', os.getcwd()) self.memsize = config.setdefault('memsize', (0, 'GB')) + self.cpulist = config.setdefault('cpulist', None) self._logging = config.setdefault('logging', True) self._cfg = config self.mydir = None @@ -112,11 +113,13 @@ class LoadModules(RtEvalModules): raise TypeError("modparams attribute is not of a dictionary type") modcfg = self._cfg.GetSection(self._module_config) + cpulist = modcfg.cpulist for m in modcfg: # hope to eventually have different kinds but module is only on # for now (jcw) if m[1].lower() == 'module': self._cfg.AppendConfig(m[0], modparams) + self._cfg.AppendConfig(m[0], {'cpulist': cpulist}) modobj = self._InstantiateModule(m[0], self._cfg.GetSection(m[0])) self._RegisterModuleObject(m[0], modobj) @@ -141,4 +144,3 @@ class LoadModules(RtEvalModules): if self.__loadavg_samples == 0: self.SaveLoadAvg() return float(self.__loadavg_accum / self.__loadavg_samples) - diff --git a/rteval/modules/measurement/__init__.py b/rteval/modules/measurement/__init__.py index 3573b0f..b382971 100644 --- a/rteval/modules/measurement/__init__.py +++ b/rteval/modules/measurement/__init__.py @@ -156,6 +156,8 @@ measurement profiles, based on their characteristics""" raise TypeError("modparams attribute is not of a dictionary type") modcfg = self.__cfg.GetSection("measurement") + cpulist = modcfg.cpulist + for (modname, modtype) in modcfg: if modtype.lower() == 'module': # Only 'module' will be supported (ds) # Extract the measurement modules info @@ -176,6 +178,7 @@ measurement profiles, based on their characteristics""" # Setup this imported module inside the appropriate measurement profile self.__cfg.AppendConfig(modname, modparams) + self.__cfg.AppendConfig(modname, {'cpulist':cpulist}) mp.Setup(modname) del self.__container |