summaryrefslogtreecommitdiffstats
path: root/rteval/modules/measurement/__init__.py
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2012-12-19 17:07:38 +0100
committerDavid Sommerseth <davids@redhat.com>2012-12-19 17:07:38 +0100
commit77fcdf51e62efa910eb25eb055fa8909f6ea71cf (patch)
treea61801f276a4efb20d1622d37e8ea508eb730f23 /rteval/modules/measurement/__init__.py
parent96d0f3853fbac2b05dfb9fa97372f3a354083dd2 (diff)
downloadrteval-77fcdf51e62efa910eb25eb055fa8909f6ea71cf.tar.gz
rteval-77fcdf51e62efa910eb25eb055fa8909f6ea71cf.tar.xz
rteval-77fcdf51e62efa910eb25eb055fa8909f6ea71cf.zip
Instead of passing the config class a few places, save it in __init__()
This cleans up the API a little bit, and lets the configuration access become a bit easier in the load and measurement classes. Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'rteval/modules/measurement/__init__.py')
-rw-r--r--rteval/modules/measurement/__init__.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/rteval/modules/measurement/__init__.py b/rteval/modules/measurement/__init__.py
index 90345ad..2a46bcc 100644
--- a/rteval/modules/measurement/__init__.py
+++ b/rteval/modules/measurement/__init__.py
@@ -29,7 +29,7 @@ from rteval.modules import RtEvalModules, ModuleContainer
class MeasurementProfile(RtEvalModules):
"""Keeps and controls all the measurement modules with the same measurement profile"""
- def __init__(self, with_load, run_parallel, modules_root, logger):
+ def __init__(self, config, with_load, run_parallel, modules_root, logger):
self.__with_load = with_load
self.__run_parallel = run_parallel
@@ -39,7 +39,7 @@ class MeasurementProfile(RtEvalModules):
self._module_type = "measurement"
self._module_config = "measurement"
self._report_tag = "Profile"
- RtEvalModules.__init__(self, modules_root, logger)
+ RtEvalModules.__init__(self, config, modules_root, logger)
def GetProfile(self):
@@ -52,10 +52,10 @@ class MeasurementProfile(RtEvalModules):
return self._ImportModule(module)
- def Setup(self, modname, modcfg):
+ def Setup(self, modname):
"Instantiates and prepares a measurement module"
- modobj = self._InstantiateModule(modname, modcfg)
+ modobj = self._InstantiateModule(modname, self._cfg.GetSection(modname))
self._RegisterModuleObject(modname, modobj)
@@ -165,7 +165,8 @@ measurement profiles, based on their characteristics"""
mp = self.GetProfile(modinfo["loads"], modinfo["parallel"])
if mp is None:
# If not found, create a new measurement profile
- mp = MeasurementProfile(modinfo["loads"], modinfo["parallel"],
+ mp = MeasurementProfile(self.__cfg,
+ modinfo["loads"], modinfo["parallel"],
self.__modules_root, self.__logger)
self.__measureprofiles.append(mp)
@@ -175,7 +176,7 @@ measurement profiles, based on their characteristics"""
# Setup this imported module inside the appropriate measurement profile
self.__cfg.AppendConfig(modname, modparams)
- mp.Setup(modname, self.__cfg.GetSection(modname))
+ mp.Setup(modname)
del self.__container