On Thu, Mar 26, 2020 at 11:41:50AM +0100, Ondrej Lichtner wrote:
On Tue, Mar 24, 2020 at 05:49:08PM +0100, Jan Tluka wrote:
> Unless the get_ping_evaluators() method is overriden, the default Ping
> evaluator will be set to RatePingEvaluator with the minimum ping rate of 50%.
>
> v2:
>
> I moved the registration of default Ping evaluator to separate
> class method because individual classes may need specific evaluators
> for specific Ping configurations.
>
> Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
> ---
> lnst/Recipes/ENRT/BaseEnrtRecipe.py | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> index d5d52bb9..84d192ee 100644
> --- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> +++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> @@ -14,6 +14,7 @@ from lnst.RecipeCommon.Perf.Measurements import Flow as PerfFlow
> from lnst.RecipeCommon.Perf.Measurements import IperfFlowMeasurement
> from lnst.RecipeCommon.Perf.Measurements import StatCPUMeasurement
> from lnst.RecipeCommon.Perf.Evaluators import NonzeroFlowEvaluator
> +from lnst.RecipeCommon.Ping.Evaluators import RatePingEvaluator
>
> class EnrtConfiguration(object):
> pass
> @@ -133,6 +134,9 @@ class BaseEnrtRecipe(BaseSubConfigMixin, PingTestAndEvaluate,
PerfRecipe):
> size = self.params.ping_psize,
> )
>
> + ping_evaluators = self.get_ping_evaluators(pconf)
> + pconf.register_evaluators(ping_evaluators)
> +
> ping_conf_list.append(pconf)
>
> if self.params.ping_bidirect:
> @@ -146,6 +150,9 @@ class BaseEnrtRecipe(BaseSubConfigMixin, PingTestAndEvaluate,
PerfRecipe):
> def generate_ping_endpoints(self, config):
> return []
>
> + def get_ping_evaluators(self, pconf):
> + return [RatePingEvaluator(min_rate=50)]
> +
This should jus tbe a property to be consistent with how perf evaluators
are defined:
Nevermind... I just noticed that this takes a "pconf" parameter, in that
case, this is a "generator" method and it would, in my opinion, be more
appropriate to rename it to "generate_ping_evaluators".
-Ondrej