Commit e3243cf2 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

closes #5637 implement branch name in run.stress-tests.py


git-svn-id: file:///svn/toku/tokudb@49304 c7de825b-a66e-492c-adef-691d508d4ae1
parent 469a2bb0
...@@ -351,7 +351,7 @@ class Worker(Thread): ...@@ -351,7 +351,7 @@ class Worker(Thread):
debug('%s exiting.' % self) debug('%s exiting.' % self)
class Scheduler(Queue): class Scheduler(Queue):
def __init__(self, nworkers, maxlarge, logger, email): def __init__(self, nworkers, maxlarge, logger, email, branch):
Queue.__init__(self) Queue.__init__(self)
info('Initializing scheduler with %d jobs.', nworkers) info('Initializing scheduler with %d jobs.', nworkers)
self.nworkers = nworkers self.nworkers = nworkers
...@@ -365,6 +365,7 @@ class Scheduler(Queue): ...@@ -365,6 +365,7 @@ class Scheduler(Queue):
self.timer = None self.timer = None
self.error = None self.error = None
self.email = email self.email = email
self.branch = branch
def run(self, timeout): def run(self, timeout):
info('Starting workers.') info('Starting workers.')
...@@ -427,7 +428,7 @@ class Scheduler(Queue): ...@@ -427,7 +428,7 @@ class Scheduler(Queue):
''' % runner.oldversionstr ''' % runner.oldversionstr
else: else:
upgradestr = '' upgradestr = ''
m = MIMEText('''A stress test failed on %(hostname)s at svn revision %(rev)s after %(test_duration)d seconds. m = MIMEText('''A stress test failed on %(hostname)s running %(branch)s at svn revision %(rev)s after %(test_duration)d seconds.
%(upgradestr)sIts environment is saved to %(tarfile)s on that machine. %(upgradestr)sIts environment is saved to %(tarfile)s on that machine.
The test configuration was: The test configuration was:
...@@ -447,14 +448,15 @@ num_update_threads: %(num_update)d ...@@ -447,14 +448,15 @@ num_update_threads: %(num_update)d
'tsize': runner.tsize, 'tsize': runner.tsize,
'csize': runner.csize, 'csize': runner.csize,
'num_ptquery': runner.num_ptquery, 'num_ptquery': runner.num_ptquery,
'num_update': runner.num_update 'num_update': runner.num_update,
'branch': self.branch,
}) })
fromaddr = 'tim@tokutek.com' fromaddr = 'tim@tokutek.com'
toaddrs = ['tokueng@tokutek.com'] toaddrs = ['tokueng@tokutek.com']
m['From'] = fromaddr m['From'] = fromaddr
m['To'] = ', '.join(toaddrs) m['To'] = ', '.join(toaddrs)
m['Subject'] = 'Stress test failure on %s.' % h m['Subject'] = 'Stress test failure on %(hostname)s running %(branch)s.' % { 'hostname': h, 'branch': self.branch }
s = SMTP('192.168.1.114') s = SMTP('192.168.1.114')
s.sendmail(fromaddr, toaddrs, str(m)) s.sendmail(fromaddr, toaddrs, str(m))
s.quit() s.quit()
...@@ -533,7 +535,7 @@ def main(opts): ...@@ -533,7 +535,7 @@ def main(opts):
info('Saving pass/fail logs to %s.', opts.log) info('Saving pass/fail logs to %s.', opts.log)
info('Saving failure environments to %s.', opts.savedir) info('Saving failure environments to %s.', opts.savedir)
scheduler = Scheduler(opts.jobs, opts.maxlarge, logger, opts.email) scheduler = Scheduler(opts.jobs, opts.maxlarge, logger, opts.email, opts.branch)
runners = [] runners = []
for tsize in [2000, 200000, 50000000]: for tsize in [2000, 200000, 50000000]:
...@@ -689,6 +691,20 @@ if __name__ == '__main__': ...@@ -689,6 +691,20 @@ if __name__ == '__main__':
parser.add_option('--tokudb', type='string', dest='tokudb', parser.add_option('--tokudb', type='string', dest='tokudb',
default=default_toplevel, default=default_toplevel,
help=('top of the tokudb tree (contains ft/ and src/) [default=%s]' % os.path.relpath(default_toplevel))) help=('top of the tokudb tree (contains ft/ and src/) [default=%s]' % os.path.relpath(default_toplevel)))
toplevel_basename = os.path.basename(default_toplevel)
if toplevel_basename == 'tokudb':
maybe_absolute_branchpath = os.path.dirname(default_toplevel)
if os.path.dirname(maybe_absolute_branchpath) == 'mysql.branches':
default_branchname = os.path.basename(maybe_absolute_branchpath)
else:
default_branchname = 'mainline'
elif toplevel_basename[:7] == 'tokudb.':
default_branchname = toplevel_basename[7:]
else:
default_branchname = 'unknown branch'
parser.add_option('--branch', type='string', dest='branch',
default=default_branchname,
help=('what to call this branch [default=%s]' % default_branchname))
test_group = OptionGroup(parser, 'Scheduler Options', 'Control how the scheduler runs jobs.') test_group = OptionGroup(parser, 'Scheduler Options', 'Control how the scheduler runs jobs.')
test_group.add_option('-t', '--test_time', type='int', dest='test_time', test_group.add_option('-t', '--test_time', type='int', dest='test_time',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment