On Mon, Dec 21, 2020 at 01:17:48PM +0100, Jan Tluka wrote:
Fri, Dec 18, 2020 at 02:21:21PM CET, olichtne(a)redhat.com wrote:
>From: Ondrej Lichtner <olichtne(a)redhat.com>
>
>Can be useful for inspecting the measurement objects.
>
>Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
>---
> lnst/RecipeCommon/Perf/Measurements/BaseFlowMeasurement.py | 4 ++++
> lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py | 4 ++++
> lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py | 4 ++++
> 3 files changed, 12 insertions(+)
>
>diff --git a/lnst/RecipeCommon/Perf/Measurements/BaseFlowMeasurement.py
b/lnst/RecipeCommon/Perf/Measurements/BaseFlowMeasurement.py
>index 856eeba..f76a25a 100644
>--- a/lnst/RecipeCommon/Perf/Measurements/BaseFlowMeasurement.py
>+++ b/lnst/RecipeCommon/Perf/Measurements/BaseFlowMeasurement.py
>@@ -195,6 +195,10 @@ def add_results(self, results):
> raise MeasurementError("Adding incorrect results.")
>
> class BaseFlowMeasurement(BaseMeasurement):
>+ @property
>+ def flows(self):
>+ raise NotImplementedError()
>+
> @classmethod
> def report_results(cls, recipe, results):
> for flow_results in results:
>diff --git a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
>index c193987..4c110f6 100644
>--- a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
>+++ b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
>@@ -27,6 +27,10 @@ def __init__(self, *args):
>
> self._hosts_versions = {}
>
>+ @property
>+ def flows(self):
>+ return self._conf
>+
This is quite confusing. I think the IperfFlowMeasurement code should be
updated to match the implementation of the TRexFlowMeasurement class.
So that the init of the IperfFlowMeasurement looks like:
def __init__(self, flows, recipe_conf):
super(IperfFlowMeasurement, self).__init__(
measurement_conf=dict(
flows=flows,
),
recipe_conf=recipe_conf
)
self._flows = flows
and then return the self._flows directly.
What do you think?
Yeah, the reason why IperfFlowMeasurement does it differently is because
it has a simpler configuration - the entire configuration is literally
the list of flows that should be measured. TRex requires a bit more so
there's a little bit more logic there.
I agree though, this could be nicer/refactored a little so I'll look
into it. Your proposal is ok, but I wonder if there's something better
(the Trex approach was kind of ad-hoc, not thinking it would become
useful in other places...).
-Ondrej
> @property
> def version(self):
> if not self._hosts_versions:
>diff --git a/lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py
b/lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py
>index c12e922..e047420 100644
>--- a/lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py
>+++ b/lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py
>@@ -37,6 +37,10 @@ def __init__(self, flows, trex_dir, server_cpu_cores,
recipe_conf=None):
>
> self._hosts_versions = {}
>
>+ @property
>+ def flows(self):
>+ return self._flows
>+
> @property
> def version(self):
> if not self._hosts_versions:
>--
>2.29.2
>_______________________________________________
>LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
>To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
>Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
>List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
>List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...