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
This commit is contained in:
Sai Sindhur Malleni 2017-01-10 14:09:19 -05:00
parent 27c234c8e4
commit 7286fb07c3
2 changed files with 13 additions and 2 deletions

View File

@ -67,6 +67,7 @@ rally:
- name: authenticate
enabled: true
concurrency:
- 16
- 8
- 16
times: 50

View File

@ -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(