From: Ondrej Lichtner <olichtne(a)redhat.com>
This property can be used to reference the "full" recipe configuration
from the Perf.RecipeConfiguration - the main use case here is that
during evaluation we want to be able to inspect the *snapshot* of the
full configuration of the recipe at the time when the measurement was
taken (even if the evaluation is done later).
Because of this the initialization of the property from the
BaseEnrtRecipe is done via a "copy.deepcopy" call to ensure that the
full snapshot is stored.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/RecipeCommon/Perf/Recipe.py | 8 +++++++-
lnst/Recipes/ENRT/BaseEnrtRecipe.py | 2 ++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lnst/RecipeCommon/Perf/Recipe.py b/lnst/RecipeCommon/Perf/Recipe.py
index 041f3b5..e8fff4a 100644
--- a/lnst/RecipeCommon/Perf/Recipe.py
+++ b/lnst/RecipeCommon/Perf/Recipe.py
@@ -12,10 +12,11 @@
)
class RecipeConf(object):
- def __init__(self, measurements, iterations):
+ def __init__(self, measurements, iterations, parent_recipe_config = None):
self._measurements = measurements
self._evaluators = dict()
self._iterations = iterations
+ self._parent_recipe_config = parent_recipe_config
@property
def measurements(self):
@@ -35,6 +36,11 @@ def register_evaluators(self, measurement, evaluators):
def iterations(self):
return self._iterations
+ @property
+ def parent_recipe_config(self):
+ return self._parent_recipe_config
+
+
class RecipeResults(object):
def __init__(self, recipe_conf):
self._recipe_conf = recipe_conf
diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
index 110ee88..9813ba6 100644
--- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
+++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
@@ -1,4 +1,5 @@
import pprint
+import copy
from contextlib import contextmanager
from lnst.Common.LnstError import LnstError
@@ -399,6 +400,7 @@ def generate_perf_configurations(self, config):
perf_conf = PerfRecipeConf(
measurements=measurements,
iterations=self.params.perf_iterations,
+ parent_recipe_config=copy.deepcopy(config),
)
self.register_perf_evaluators(perf_conf)
--
2.30.0