From 1f59f2e6769cc7ae6f3b73eb1ce8ee09f2929f72 Mon Sep 17 00:00:00 2001 From: chenjiankun Date: Wed, 3 May 2017 01:05:01 +0000 Subject: Bugfix: KeyError when using http dispatcher JIRA: YARDSTICK-632 When we use http dispatcher to output yardstick result. It can upload data, but when we query the data, it get a KeyError. Change-Id: I5410c207c68cff2621ff8184ae17daa4c286cea5 Signed-off-by: chenjiankun --- yardstick/benchmark/runners/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'yardstick/benchmark/runners/base.py') diff --git a/yardstick/benchmark/runners/base.py b/yardstick/benchmark/runners/base.py index 7c76e42df..b48ed973a 100755 --- a/yardstick/benchmark/runners/base.py +++ b/yardstick/benchmark/runners/base.py @@ -22,6 +22,7 @@ import logging import multiprocessing import subprocess import time +import os import traceback from oslo_config import cfg @@ -40,7 +41,11 @@ def _output_serializer_main(filename, queue, config): Use of this process enables multiple instances of a scenario without messing up the output file. """ - out_type = config['yardstick'].get('DEFAULT', {}).get('dispatcher', 'file') + try: + out_type = config['yardstick'].get('DEFAULT', {})['dispatcher'] + except KeyError: + out_type = os.environ.get('DISPATCHER', 'file') + conf = { 'type': out_type.capitalize(), 'file_path': filename -- cgit 1.2.3-korg