It make more sense to have both BasePerfTestTweakMixin and BasePerfTestIterationTweakMixin in one place.
In addition, the BasePerfTestTweakMixin was moved from BaseEnrtRecipe to Perf.Recipe class.
Signed-off-by: Jan Tluka jtluka@redhat.com --- .../Perf}/PerfTestMixins/BasePerfTestTweakMixin.py | 0 lnst/RecipeCommon/Perf/Recipe.py | 13 ++++++++++--- lnst/Recipes/ENRT/BaseEnrtRecipe.py | 9 ++------- .../PerfTestMixins/SctpFirewallPerfTestMixin.py | 2 +- lnst/Recipes/ENRT/PerfTestMixins/__init__.py | 1 - 5 files changed, 13 insertions(+), 12 deletions(-) rename lnst/{Recipes/ENRT => RecipeCommon/Perf}/PerfTestMixins/BasePerfTestTweakMixin.py (100%)
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/BasePerfTestTweakMixin.py b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py similarity index 100% rename from lnst/Recipes/ENRT/PerfTestMixins/BasePerfTestTweakMixin.py rename to lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py diff --git a/lnst/RecipeCommon/Perf/Recipe.py b/lnst/RecipeCommon/Perf/Recipe.py index 03494b29..d1098fa2 100644 --- a/lnst/RecipeCommon/Perf/Recipe.py +++ b/lnst/RecipeCommon/Perf/Recipe.py @@ -7,6 +7,7 @@ from lnst.RecipeCommon.Perf.Results import SequentialPerfResult from lnst.RecipeCommon.Perf.Results import ParallelPerfResult
from lnst.RecipeCommon.Perf.PerfTestMixins import ( + BasePerfTestTweakMixin, BasePerfTestIterationTweakMixin, )
@@ -53,12 +54,18 @@ class RecipeResults(object): aggregated_results, new_results) self._results[measurement] = aggregated_results
-class Recipe(BasePerfTestIterationTweakMixin, BaseRecipe): +class Recipe(BasePerfTestTweakMixin, BasePerfTestIterationTweakMixin, BaseRecipe): def perf_test(self, recipe_conf): results = RecipeResults(recipe_conf)
- for i in range(recipe_conf.iterations): - self.perf_test_iteration(recipe_conf, results) + self.apply_perf_test_tweak(recipe_conf) + self.describe_perf_test_tweak(recipe_conf) + + try: + for i in range(recipe_conf.iterations): + self.perf_test_iteration(recipe_conf, results) + finally: + self.remove_perf_test_tweak(recipe_conf)
return results
diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py b/lnst/Recipes/ENRT/BaseEnrtRecipe.py index d629b726..180f922e 100644 --- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py +++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py @@ -355,13 +355,8 @@ class BaseEnrtRecipe(CommonPerfTestTweakMixin, methods to execute, report and evaluate the results. """ for perf_config in self.generate_perf_configurations(recipe_config): - self.apply_perf_test_tweak(perf_config) - self.describe_perf_test_tweak(perf_config) - try: - result = self.perf_test(perf_config) - self.perf_report_and_evaluate(result) - finally: - self.remove_perf_test_tweak(perf_config) + result = self.perf_test(perf_config) + self.perf_report_and_evaluate(result)
def generate_ping_configurations(self, config): """Base ping test configuration generator diff --git a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py index c0520405..841df3f7 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py @@ -1,5 +1,5 @@ from lnst.Controller.RecipeResults import ResultLevel -from lnst.Recipes.ENRT.PerfTestMixins import BasePerfTestTweakMixin +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestTweakMixin
class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): def apply_perf_test_tweak(self, perf_config): diff --git a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py index 8a109ad0..addfb641 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py @@ -1,3 +1,2 @@ -from lnst.Recipes.ENRT.PerfTestMixins.BasePerfTestTweakMixin import BasePerfTestTweakMixin from lnst.Recipes.ENRT.PerfTestMixins.SctpFirewallPerfTestMixin import SctpFirewallPerfTestMixin from lnst.Recipes.ENRT.PerfTestMixins.CommonPerfTestTweakMixin import CommonPerfTestTweakMixin