diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-10-02 14:21:18 -0700 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-10-02 17:29:37 -0700 |
commit | 6715aba75fa0037f092add386cb9e9a50a58f30a (patch) | |
tree | 342f2cc694f3f56eb8c6f30bcfd0bab5d85cfba6 | |
parent | dd3cbc21dfb505ea70dd3574869c1fb33b7de956 (diff) |
runners: add timeout to queue put
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>
-rw-r--r-- | yardstick/benchmark/runners/duration.py | 9 | ||||
-rw-r--r-- | yardstick/benchmark/runners/iteration.py | 11 |
2 files changed, 14 insertions, 6 deletions
diff --git a/yardstick/benchmark/runners/duration.py b/yardstick/benchmark/runners/duration.py index 75942766d..2cb2600c8 100644 --- a/yardstick/benchmark/runners/duration.py +++ b/yardstick/benchmark/runners/duration.py @@ -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}) diff --git a/yardstick/benchmark/runners/iteration.py b/yardstick/benchmark/runners/iteration.py index 4a7439588..88158eed3 100644 --- a/yardstick/benchmark/runners/iteration.py +++ b/yardstick/benchmark/runners/iteration.py @@ -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"], |