improving if conditions :) 15/29015/2
authorDeepak S <deepak.s@linux.intel.com>
Sat, 18 Feb 2017 12:36:56 +0000 (18:06 +0530)
committerDeepak S <deepak.s@linux.intel.com>
Tue, 21 Feb 2017 03:03:44 +0000 (08:33 +0530)
Change-Id: I2fad46b07b252f898acfe116dd6542946b8a26a8
Signed-off-by: Deepak S <deepak.s@linux.intel.com>
yardstick/benchmark/contexts/heat.py
yardstick/benchmark/runners/base.py

index 4c7f052..4ca44b0 100644 (file)
@@ -158,7 +158,7 @@ class HeatContext(Context):
             # workround for openstack nova bug, check JIRA: YARDSTICK-200
             # for details
             if len(availability_servers) == 2:
-                if len(scheduler_hints["different_host"]) == 0:
+                if not scheduler_hints["different_host"]:
                     scheduler_hints.pop("different_host", None)
                     server.add_to_template(template,
                                            self.networks,
@@ -197,7 +197,7 @@ class HeatContext(Context):
 
         # add remaining servers with no placement group configured
         for server in list_of_servers:
-            if len(server.placement_groups) == 0:
+            if not server.placement_groups:
                 server.add_to_template(template, self.networks, {})
 
     def deploy(self):
index bf1a71c..5b90815 100755 (executable)
@@ -127,7 +127,7 @@ class Runner(object):
         """Returns instance of a scenario runner for execution type.
         """
         # if there is no runner, start the output serializer subprocess
-        if len(Runner.runners) == 0:
+        if not Runner.runners:
             log.debug("Starting dump process file '%s'",
                       config["output_filename"])
             Runner.queue = multiprocessing.Queue()
@@ -155,7 +155,7 @@ class Runner(object):
             Runner.runners.remove(runner)
 
         # if this was the last runner, stop the output serializer subprocess
-        if len(Runner.runners) == 0:
+        if not Runner.runners:
             Runner.release_dump_process()
 
     @staticmethod
@@ -170,7 +170,7 @@ class Runner(object):
         log.debug("Terminating all runners")
 
         # release dumper process as some errors before any runner is created
-        if len(Runner.runners) == 0:
+        if not Runner.runners:
             Runner.release_dump_process()
             return