From: Ondrej Lichtner <olichtne(a)redhat.com>
Downgraded most of the info level logging messages to the debug level as
they're often times not that helpful with understanding what the recipe
is testing.
At the same time I set the default result level to IMPORTANT for every
Job run on a host (through the host.run(), or host.prepare_job()
methods). This changes the approach for the testers:
- the original approach was to assume that jobs run by the testers were
unimportant unless specifically marked as important
- the new approach flips this assumption - all jobs by the testers are
important, unless specifically marked as not.
This should hopefully make it more natural for a tester to understand
the logs and result summary of a recipe.
I went ahead and adjusted the result levels of some smaller jobs in the
StatCPUMeasurement and BaseEnrtRecipe code to keep the original
behaviour.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Job.py | 4 ++--
lnst/Controller/Machine.py | 7 +++---
lnst/Controller/Namespace.py | 2 +-
.../Perf/Measurements/StatCPUMeasurement.py | 9 +++++++-
lnst/Recipes/ENRT/BaseEnrtRecipe.py | 22 +++++++++++++------
lnst/Slave/Job.py | 2 +-
6 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/lnst/Controller/Job.py b/lnst/Controller/Job.py
index 22814e6..9c50210 100644
--- a/lnst/Controller/Job.py
+++ b/lnst/Controller/Job.py
@@ -195,11 +195,11 @@ def kill(self, signal=signal.SIGKILL):
False if an exception was raised while sending the signal.
"""
if self.finished:
- logging.info("Job {} on host {} already finished, skipping kill
call."
+ logging.debug("Job {} on host {} already finished, skipping kill
call."
.format(self._id, self._netns.hostid))
return True
- logging.info("Sending signal {} to job {} on host {}".format(signal,
+ logging.debug("Sending signal {} to job {} on host {}".format(signal,
self._id, self._netns.hostid))
return self._netns._machine.kill(self, signal)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 5fd5c88..6c6f8d1 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -401,8 +401,9 @@ def run_job(self, job):
if job.type == "module":
self.send_class(job._what.__class__)
- logging.info("Host %s executing job %d: %s" %
+ logging.debug("Host %s executing job %d: %s" %
(self._id, job.id, str(job)))
+ logging.debug("Job.what = {}".format(repr(job.what)))
if job._desc is not None:
logging.info("Job description: %s" % job._desc)
@@ -419,10 +420,10 @@ def wait_for_job(self, job, timeout):
(job.id, self._id))
if timeout > 0:
- logging.info("Waiting for Job %d on Host %s for %d seconds." %
+ logging.debug("Waiting for Job %d on Host %s for %d seconds." %
(job.id, self._id, timeout))
elif timeout == 0:
- logging.info("Waiting for Job %d on Host %s." %
+ logging.debug("Waiting for Job %d on Host %s." %
(job.id, self._id))
def condition():
diff --git a/lnst/Controller/Namespace.py b/lnst/Controller/Namespace.py
index 7ff7f2a..6d96e7d 100644
--- a/lnst/Controller/Namespace.py
+++ b/lnst/Controller/Namespace.py
@@ -90,7 +90,7 @@ def prepare_job(self, what, fail=False, json=False, desc=None,
level=job_level)
def run(self, what, fail=False, json=False, desc=None,
- job_level=ResultLevel.DEBUG, bg=False, timeout=DEFAULT_TIMEOUT):
+ job_level=ResultLevel.IMPORTANT, bg=False, timeout=DEFAULT_TIMEOUT):
"""
Args:
what (mandatory) -- what should be run on the host. Can be either a
diff --git a/lnst/RecipeCommon/Perf/Measurements/StatCPUMeasurement.py
b/lnst/RecipeCommon/Perf/Measurements/StatCPUMeasurement.py
index dd2fd64..5dbf404 100644
--- a/lnst/RecipeCommon/Perf/Measurements/StatCPUMeasurement.py
+++ b/lnst/RecipeCommon/Perf/Measurements/StatCPUMeasurement.py
@@ -1,5 +1,6 @@
import signal
+from lnst.Controller.RecipeResults import ResultLevel
from lnst.RecipeCommon.Perf.Results import PerfInterval
from lnst.RecipeCommon.Perf.Results import SequentialPerfResult
from lnst.RecipeCommon.Perf.Results import ParallelPerfResult
@@ -38,7 +39,13 @@ def version(self):
def start(self):
jobs = []
for host in self._conf:
- jobs.append(host.run(CPUStatMonitor(interval=1000),bg=True))
+ jobs.append(
+ host.run(
+ CPUStatMonitor(interval=1000),
+ bg=True,
+ job_level=ResultLevel.NORMAL,
+ )
+ )
self._running_measurements = jobs
def finish(self):
diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
index 249fffa..18e4040 100644
--- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
+++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
@@ -5,6 +5,7 @@
from lnst.Common.IpAddress import AF_INET, AF_INET6
from lnst.Common.ExecCmd import exec_cmd
from lnst.Controller.Recipe import BaseRecipe, RecipeError
+from lnst.Controller.RecipeResults import ResultLevel
from lnst.RecipeCommon.Ping import PingTestAndEvaluate, PingConf
from lnst.RecipeCommon.Perf.Recipe import Recipe as PerfRecipe
@@ -340,7 +341,7 @@ def _create_reverse_ping(self, pconf, args):
def _pin_dev_interrupts(self, dev, cpu):
netns = dev.netns
- cpu_info = netns.run("lscpu").stdout
+ cpu_info = netns.run("lscpu", job_level=ResultLevel.DEBUG).stdout
regex = "CPU\(s\): *([0-9]*)"
num_cpus = int(re.search(regex, cpu_info).groups()[0])
if cpu < 0 or cpu > num_cpus - 1:
@@ -348,14 +349,21 @@ def _pin_dev_interrupts(self, dev, cpu):
(cpu, "is: 0" if num_cpus == 1 else "are:
0..%d" %
(num_cpus - 1)))
- res = netns.run("grep {} /proc/interrupts | cut -f1 -d: | sed 's/
//'"
- .format(dev.name))
+ res = netns.run(
+ "grep {} /proc/interrupts | cut -f1 -d: | sed 's/
//'".format(
+ dev.name
+ ),
+ job_level=ResultLevel.DEBUG,
+
+ )
intrs = res.stdout
split = res.stdout.split("\n")
- if len(split) == 1 and split[0] == '':
- res = netns.run("dev_irqs=/sys/class/net/{}/device/msi_irqs; "
- "[ -d $dev_irqs ] && ls -1 $dev_irqs"
- .format(dev.name))
+ if len(split) == 1 and split[0] == "":
+ res = netns.run(
+ "dev_irqs=/sys/class/net/{}/device/msi_irqs; "
+ "[ -d $dev_irqs ] && ls -1
$dev_irqs".format(dev.name),
+ job_level=ResultLevel.DEBUG,
+ )
intrs = res.stdout
for intr in intrs.split("\n"):
diff --git a/lnst/Slave/Job.py b/lnst/Slave/Job.py
index 8790487..004ef02 100644
--- a/lnst/Slave/Job.py
+++ b/lnst/Slave/Job.py
@@ -91,7 +91,7 @@ def run(self):
self._process.start()
self._pid = self._process.pid
- logging.info("Running job %d with pid \"%d\"" % (self._id,
self._pid))
+ logging.debug("Running job %d with pid \"%d\"" % (self._id,
self._pid))
return True
def _run(self):
--
2.21.0