mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-06 18:35:18 +00:00
Mode frequent progressbar update
This commit is contained in:
parent
4a03d23097
commit
dab4cdd007
@ -775,15 +775,16 @@ class Stepper:
|
|||||||
pbar = ProgressBar(widgets=widgets, maxval=max_progress).start()
|
pbar = ProgressBar(widgets=widgets, maxval=max_progress).start()
|
||||||
base_time = 0
|
base_time = 0
|
||||||
|
|
||||||
pattern_uri = \
|
pattern_uri = re.compile("^(GET|POST|PUT|HEAD|OPTIONS|PATCH|DELETE|TRACE|LINK|UNLINK|PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK\s+)?\s*(\/(.*?))($|\s)")
|
||||||
re.compile("^(GET|POST|PUT|HEAD|OPTIONS|PATCH|DELETE|TRACE|LINK|UNLINK|PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK\s+)?\s*(\/(.*?))($|\s)"
|
|
||||||
)
|
|
||||||
|
|
||||||
chunk_case = ''
|
chunk_case = ''
|
||||||
|
|
||||||
input_ammo = open(ammo_file, 'rb')
|
input_ammo = open(ammo_file, 'rb')
|
||||||
stepped_ammo = open(self.stpd_file, 'wb')
|
stepped_ammo = open(self.stpd_file, 'wb')
|
||||||
for step in load_steps:
|
for step in load_steps:
|
||||||
|
if not (cur_progress / 100) % 2:
|
||||||
|
pbar.update(cur_progress)
|
||||||
|
|
||||||
if case == 3:
|
if case == 3:
|
||||||
if stop_loop_count > 0 and cur_progress == stop_loop_count:
|
if stop_loop_count > 0 and cur_progress == stop_loop_count:
|
||||||
break
|
break
|
||||||
@ -807,8 +808,7 @@ class Stepper:
|
|||||||
chunk_start)
|
chunk_start)
|
||||||
|
|
||||||
if m:
|
if m:
|
||||||
(chunk_size, chunk_case) = (int(m.group(1)),
|
(chunk_size, chunk_case) = (int(m.group(1)), m.group(2))
|
||||||
m.group(2))
|
|
||||||
|
|
||||||
already_cases[chunk_case] += 1
|
already_cases[chunk_case] += 1
|
||||||
chunk = input_ammo.read(chunk_size)
|
chunk = input_ammo.read(chunk_size)
|
||||||
@ -820,8 +820,7 @@ class Stepper:
|
|||||||
if not chunk_case:
|
if not chunk_case:
|
||||||
request = pattern_uri.match(chunk)
|
request = pattern_uri.match(chunk)
|
||||||
if request:
|
if request:
|
||||||
chunk_case = \
|
chunk_case = get_prepared_case(request.group(2), cases_done, pattern)
|
||||||
get_prepared_case(request.group(2), cases_done, pattern)
|
|
||||||
else:
|
else:
|
||||||
chunk_case = 'other'
|
chunk_case = 'other'
|
||||||
|
|
||||||
@ -830,24 +829,17 @@ class Stepper:
|
|||||||
if case == 3:
|
if case == 3:
|
||||||
time = base_time + marked[step_ammo_num]
|
time = base_time + marked[step_ammo_num]
|
||||||
elif case == 2:
|
elif case == 2:
|
||||||
|
if step_ammo_num < instances_schedule_count:
|
||||||
if step_ammo_num\
|
|
||||||
< instances_schedule_count:
|
|
||||||
if not instances_chunk_cnt:
|
if not instances_chunk_cnt:
|
||||||
[instances_chunk_cnt,
|
[instances_chunk_cnt, instances_chunk_time] = instances_schedule.pop(0)
|
||||||
instances_chunk_time] = instances_schedule.pop(0)
|
base_time += instances_chunk_time * 1000
|
||||||
base_time += \
|
|
||||||
instances_chunk_time * 1000
|
|
||||||
instances_chunk_cnt -= 1
|
instances_chunk_cnt -= 1
|
||||||
time = base_time
|
time = base_time
|
||||||
else:
|
else:
|
||||||
|
|
||||||
time = 1000
|
time = 1000
|
||||||
|
|
||||||
if chunk_case:
|
if chunk_case:
|
||||||
stepped_ammo.write('%s %s %s\n'
|
stepped_ammo.write('%s %s %s\n' % (chunk_size, time, chunk_case))
|
||||||
% (chunk_size, time,
|
|
||||||
chunk_case))
|
|
||||||
else:
|
else:
|
||||||
stepped_ammo.write('%s %s\n'
|
stepped_ammo.write('%s %s\n'
|
||||||
% (chunk_size, time))
|
% (chunk_size, time))
|
||||||
@ -877,8 +869,7 @@ class Stepper:
|
|||||||
if m.group(2):
|
if m.group(2):
|
||||||
c = re.match("^\w+$", m.group(2))
|
c = re.match("^\w+$", m.group(2))
|
||||||
if not c:
|
if not c:
|
||||||
raise RuntimeError("Wrong case format for '%s'"
|
raise RuntimeError("Wrong case format for '%s'" % m.group(2))
|
||||||
% m.group(2))
|
|
||||||
|
|
||||||
# TODO: 2 add more info to locate problem chunk
|
# TODO: 2 add more info to locate problem chunk
|
||||||
raise RuntimeError('Wrong chunk size')
|
raise RuntimeError('Wrong chunk size')
|
||||||
@ -898,7 +889,6 @@ class Stepper:
|
|||||||
if step_ammo_num == load_count:
|
if step_ammo_num == load_count:
|
||||||
looping = 0
|
looping = 0
|
||||||
base_time += duration * 1000
|
base_time += duration * 1000
|
||||||
pbar.update(cur_progress)
|
|
||||||
|
|
||||||
stepped_ammo.write('0\n')
|
stepped_ammo.write('0\n')
|
||||||
pbar.finish()
|
pbar.finish()
|
||||||
|
Loading…
Reference in New Issue
Block a user