From 7286fb07c3fdd5d05865723a367c8b60308834de Mon Sep 17 00:00:00 2001 From: Sai Sindhur Malleni Date: Tue, 10 Jan 2017 14:09:19 -0500 Subject: [PATCH] Let user specify a duplicate concurrency value In some cases the user might want to run the same scenario with the same concurrency value multiple times. In that case currently Browbeat exits with an ugly traceback since the test name would be based on the concurrency and hyaving the same concurrency twice results in trying to create a file that already exists. This commit makes the code smart enough to recognize duplicate concurrency values and name files accordingly. For example. having 16 twice as the concurrency value for ceilometer_list_meters scenario produces two different log files as 'results/20160718-202008/CeilometerMeters/ceilometer_list_meters/ 20160718-202008-browbeat-ceilometer_list_meters-16-iteration-0.log' and 'results/20160718-202008/CeilometerMeters/ceilometer_list_meters/ 20160718-202008-browbeat-ceilometer_list_meters-16-2-iteration-0.log. Change-Id: Ie39c8c54ddf0435ff46975bfc4a5fd62995b2a32 --- ci-scripts/config/browbeat-ci.yaml | 1 + lib/Rally.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ci-scripts/config/browbeat-ci.yaml b/ci-scripts/config/browbeat-ci.yaml index d80a4e5f9..fd60aa830 100644 --- a/ci-scripts/config/browbeat-ci.yaml +++ b/ci-scripts/config/browbeat-ci.yaml @@ -67,6 +67,7 @@ rally: - name: authenticate enabled: true concurrency: + - 16 - 8 - 16 times: 50 diff --git a/lib/Rally.py b/lib/Rally.py index c6e22efe4..b616d67f1 100644 --- a/lib/Rally.py +++ b/lib/Rally.py @@ -239,6 +239,7 @@ class Rally(WorkloadBase.WorkloadBase): del scenario['concurrency'] else: concurrencies = def_concurrencies + concurrency_count_dict = collections.Counter(concurrencies) if 'times' not in scenario: scenario['times'] = def_times @@ -249,8 +250,17 @@ class Rally(WorkloadBase.WorkloadBase): results[run] = [] self.update_tests() self.update_total_tests() - test_name = "{}-browbeat-{}-{}-iteration-{}".format( - dir_ts, scenario_name, concurrency, run) + if concurrency_count_dict[concurrency] == 1: + test_name = "{}-browbeat-{}-{}-iteration-{}".format( + dir_ts, scenario_name, concurrency, run) + else: + test_name = "{}-browbeat-{}-{}-{}-iteration-{}".format( + dir_ts, scenario_name, concurrency, + concurrency_count_dict[concurrency], run) + self.logger.debug("Duplicate concurrency {} found," + " setting test name" + " to {}".format(concurrency, test_name)) + concurrency_count_dict[concurrency] -= 1 if not result_dir: self.logger.error(