Merge "Add delay in swift-bench"

This commit is contained in:
Jenkins 2013-08-29 22:54:08 +00:00 committed by Gerrit Code Review
commit 3498ddbbb9
2 changed files with 9 additions and 0 deletions

View File

@ -50,6 +50,7 @@ CONF_DEFAULTS = {
'devices': 'sdb1', # space-sep list
'log_level': 'INFO',
'timeout': '10',
'delay': '0',
'bench_clients': [],
}
@ -117,6 +118,8 @@ if __name__ == '__main__':
help='If set, will not delete the objects created')
parser.add_option('-V', '--auth_version', dest='auth_version',
help='Authentication version')
parser.add_option('-d', '--delay', dest='delay',
help='Delay before delete requests in seconds')
if len(sys.argv) == 1:
parser.print_help()

View File

@ -352,6 +352,7 @@ class BenchController(object):
self.delete = config_true_value(conf.delete)
self.gets = int(conf.num_gets)
self.aborted = False
self.delay = int(self.conf.delay)
def sigint1(self, signum, frame):
if self.delete:
@ -379,6 +380,11 @@ class BenchController(object):
self.running = gets
gets.run()
if self.delete:
if self.delay != 0:
self.logger.info('Delay before '
'DELETE request %s sec'
% self.delay)
time.sleep(self.delay)
dels = BenchDELETE(self.logger, self.conf, self.names)
self.running = dels
dels.run()