aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/compute
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2016-11-25 14:21:37 -0800
committerRoss Brattain <ross.b.brattain@intel.com>2016-11-30 16:48:34 -0800
commit4630e877d70ba453ac0d88e226a66a6f1efc7608 (patch)
tree644b8c9409c048d9cd04eacb1c19c59000612f61 /yardstick/benchmark/scenarios/compute
parent462f25c8e950110a1624909d4f79ef4219005ba2 (diff)
switch logging to proper usage
The logging methods do string interpolation themselves From the reference: https://docs.python.org/2/library/logging.html#logging.Logger.debug Logger.debug(msg, *args, **kwargs) Logs a message with level DEBUG on this logger. The msg is the message format string, and the args are the arguments which are merged into msg using the string formatting operator. (Note that this means that you can use keywords in the format string, together with a single dictionary argument.) There are two keyword arguments in kwargs which are inspected: exc_info which, if it does not evaluate as false, causes exception information to be added to the logging message. If an exception tuple (in the format returned by sys.exc_info()) is provided, it is used; otherwise, sys.exc_info() is called to get the exception informatio The reason logging does string interpolation itselfs is to implement deferred interpolation. String interpolation involves evaluating arguments, so it can introduce significant computation. The logging module tries to be smart about deferring interpolation until the last possible moment. The logging methods check isEnabledFor for the log level and won't interpolate if the level is not enabled. https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L1178 def warning(self, msg, *args, **kwargs): if self.isEnabledFor(WARNING): self._log(WARNING, msg, args, **kwargs) logging actually waits to interpolate the string in LogRecord.getMessage() https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L328 if self.args: msg = msg % self.args Change-Id: Ie09efe0a66881e19bd8119caa376075e605627a2 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/compute')
-rw-r--r--yardstick/benchmark/scenarios/compute/cachestat.py2
-rw-r--r--yardstick/benchmark/scenarios/compute/cpuload.py2
-rw-r--r--yardstick/benchmark/scenarios/compute/cyclictest.py14
-rw-r--r--yardstick/benchmark/scenarios/compute/memload.py2
4 files changed, 10 insertions, 10 deletions
diff --git a/yardstick/benchmark/scenarios/compute/cachestat.py b/yardstick/benchmark/scenarios/compute/cachestat.py
index 117702098..25300dd46 100644
--- a/yardstick/benchmark/scenarios/compute/cachestat.py
+++ b/yardstick/benchmark/scenarios/compute/cachestat.py
@@ -92,7 +92,7 @@ class CACHEstat(base.Scenario):
def _execute_command(self, cmd):
"""Execute a command on server."""
- LOG.info("Executing: %s" % cmd)
+ LOG.info("Executing: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
if status:
raise RuntimeError("Failed executing command: ",
diff --git a/yardstick/benchmark/scenarios/compute/cpuload.py b/yardstick/benchmark/scenarios/compute/cpuload.py
index a7fae44ec..9d71038ef 100644
--- a/yardstick/benchmark/scenarios/compute/cpuload.py
+++ b/yardstick/benchmark/scenarios/compute/cpuload.py
@@ -96,7 +96,7 @@ class CPULoad(base.Scenario):
def _execute_command(self, cmd):
"""Execute a command on server."""
- LOG.info("Executing: %s" % cmd)
+ LOG.info("Executing: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
if status != 0:
raise RuntimeError("Failed executing command: ",
diff --git a/yardstick/benchmark/scenarios/compute/cyclictest.py b/yardstick/benchmark/scenarios/compute/cyclictest.py
index 6a1afe223..a6c4d95cf 100644
--- a/yardstick/benchmark/scenarios/compute/cyclictest.py
+++ b/yardstick/benchmark/scenarios/compute/cyclictest.py
@@ -69,14 +69,14 @@ class Cyclictest(base.Scenario):
rpm_dir = setup_options["rpm_dir"]
script_dir = setup_options["script_dir"]
image_dir = setup_options["image_dir"]
- LOG.debug("Send RPMs from %s to workspace %s" %
- (rpm_dir, self.WORKSPACE))
+ LOG.debug("Send RPMs from %s to workspace %s",
+ rpm_dir, self.WORKSPACE)
client.put(rpm_dir, self.WORKSPACE, recursive=True)
- LOG.debug("Send scripts from %s to workspace %s" %
- (script_dir, self.WORKSPACE))
+ LOG.debug("Send scripts from %s to workspace %s",
+ script_dir, self.WORKSPACE)
client.put(script_dir, self.WORKSPACE, recursive=True)
- LOG.debug("Send guest image from %s to workspace %s" %
- (image_dir, self.WORKSPACE))
+ LOG.debug("Send guest image from %s to workspace %s",
+ image_dir, self.WORKSPACE)
client.put(image_dir, self.WORKSPACE, recursive=True)
def _connect_host(self):
@@ -102,7 +102,7 @@ class Cyclictest(base.Scenario):
self.guest.wait(timeout=600)
def _run_setup_cmd(self, client, cmd):
- LOG.debug("Run cmd: %s" % cmd)
+ LOG.debug("Run cmd: %s", cmd)
status, stdout, stderr = client.execute(cmd)
if status:
if re.search(self.REBOOT_CMD_PATTERN, cmd):
diff --git a/yardstick/benchmark/scenarios/compute/memload.py b/yardstick/benchmark/scenarios/compute/memload.py
index 48088f87c..e1ba93d02 100644
--- a/yardstick/benchmark/scenarios/compute/memload.py
+++ b/yardstick/benchmark/scenarios/compute/memload.py
@@ -61,7 +61,7 @@ class MEMLoad(base.Scenario):
def _execute_command(self, cmd):
"""Execute a command on server."""
- LOG.info("Executing: %s" % cmd)
+ LOG.info("Executing: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
if status:
raise RuntimeError("Failed executing command: ",