runners: add timeout to queue put 55/44155/1
authorRoss Brattain <ross.b.brattain@intel.com>
Mon, 2 Oct 2017 21:21:18 +0000 (14:21 -0700)
committerRoss Brattain <ross.b.brattain@intel.com>
Tue, 3 Oct 2017 18:02:09 +0000 (11:02 -0700)
we don't want to block the test waiting to put KPIs
Add moderate timeout.  In case we do timeout, it
doesn't matter if we drop intermitten KPIs

Change-Id: I049c785355993e6b286748a5c897d54dd2923dc9
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
yardstick/benchmark/runners/duration.py
yardstick/benchmark/runners/iteration.py

index 7594276..2cb2600 100644 (file)
@@ -31,6 +31,9 @@ from yardstick.benchmark.runners import base
 LOG = logging.getLogger(__name__)
 
 
+QUEUE_PUT_TIMEOUT = 10
+
+
 def _worker_process(queue, cls, method_name, scenario_cfg,
                     context_cfg, aborted, output_queue):
 
@@ -79,7 +82,9 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
             LOG.exception("")
         else:
             if result:
-                output_queue.put(result)
+                # add timeout for put so we don't block test
+                # if we do timeout we don't care about dropping individual KPIs
+                output_queue.put(result, True, QUEUE_PUT_TIMEOUT)
 
         time.sleep(interval)
 
@@ -90,7 +95,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
             'errors': errors
         }
 
-        queue.put(benchmark_output)
+        queue.put(benchmark_output, True, QUEUE_PUT_TIMEOUT)
 
         LOG.debug("runner=%(runner)s seq=%(sequence)s END",
                   {"runner": runner_cfg["runner_id"], "sequence": sequence})
index 4a74395..88158ee 100644 (file)
@@ -31,6 +31,9 @@ from yardstick.benchmark.runners import base
 LOG = logging.getLogger(__name__)
 
 
+QUEUE_PUT_TIMEOUT = 10
+
+
 def _worker_process(queue, cls, method_name, scenario_cfg,
                     context_cfg, aborted, output_queue):
 
@@ -90,8 +93,9 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
                 LOG.exception(e)
             else:
                 if result:
-                    LOG.debug("output_queue.put %s", result)
-                    output_queue.put(result, True, 1)
+                    # add timeout for put so we don't block test
+                    # if we do timeout we don't care about dropping individual KPIs
+                    output_queue.put(result, True, QUEUE_PUT_TIMEOUT)
 
             time.sleep(interval)
 
@@ -102,8 +106,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
                 'errors': errors
             }
 
-            LOG.debug("queue.put, %s", benchmark_output)
-            queue.put(benchmark_output, True, 1)
+            queue.put(benchmark_output, True, QUEUE_PUT_TIMEOUT)
 
             LOG.debug("runner=%(runner)s seq=%(sequence)s END",
                       {"runner": runner_cfg["runner_id"],