diff options
author | David Sommerseth <davids@redhat.com> | 2012-12-05 02:54:43 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2012-12-05 02:54:43 +0100 |
commit | e396e0e6c4ec3e6c7378f759963cca86a71d6985 (patch) | |
tree | 2994ba9ef9be0602237c16bee9124bcc23031baa | |
parent | 7b3153b9ff65658f0b495462abbbe2f25b8fe810 (diff) | |
download | rteval-e396e0e6c4ec3e6c7378f759963cca86a71d6985.tar.gz |
Extend the MeasurementProfile() class with an isAlive() method
This will return True if one or more of the modules which has been
started do run. If the MeasurementProfile is for parallel running
tasks, it expects all modules to be running. Otherwise it will
return True if one of the modules are running.
Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r-- | rteval/modules/__init__.py | 17 | ||||
-rw-r--r-- | rteval/modules/measurement/__init__.py | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py index b57f25c..987474a 100644 --- a/rteval/modules/__init__.py +++ b/rteval/modules/__init__.py @@ -346,6 +346,23 @@ start their workloads yet""" return nthreads + def _isAlive(self, all_running_pass): + """Returns True if all modules which are supposed to run runs""" + + ret = True + for (modname, mod) in self.__modules: + if all_running_pass: + # We requiring all modules to run to pass + ret &= mod._WorkloadAlive() + else: + # We require only a single module to run to pass + # This is used by f.ex. measurement modules, running + # serialised + ret |= mod._WorkloadAlive() + return ret + + + def Stop(self): """Stops all the running workloads from in all the loaded modules""" diff --git a/rteval/modules/measurement/__init__.py b/rteval/modules/measurement/__init__.py index b9328d0..ac16f77 100644 --- a/rteval/modules/measurement/__init__.py +++ b/rteval/modules/measurement/__init__.py @@ -64,6 +64,10 @@ class MeasurementProfile(RtEvalModules): return rep_n + def isAlive(self): + """Returns True if all modules which are supposed to run runs""" + return self._isAlive(self.__run_parallel) + class MeasurementModules(object): """Class which takes care of all measurement modules and groups them into |