[Ocfs2-tools-devel] [PATCH 2/3] Ocfs2-test: Add python mpi runner for write_append_truncate test.
Marcos E. Matsunaga
Marcos.Matsunaga at oracle.com
Thu Sep 18 05:41:05 PDT 2008
Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>
Regards,
Marcos Eduardo Matsunaga
Oracle USA
Linux Engineering
“The statements and opinions expressed here are my own and do not
necessarily represent those of Oracle Corporation.”
Tristan Ye wrote:
> The newly added runner will be in openmpi flavor.
>
> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
> ---
> .../run_write_append_truncate.py | 157 ++++++++++++++++++++
> 1 files changed, 157 insertions(+), 0 deletions(-)
> create mode 100755 programs/write_append_truncate/run_write_append_truncate.py
>
> diff --git a/programs/write_append_truncate/run_write_append_truncate.py b/programs/write_append_truncate/run_write_append_truncate.py
> new file mode 100755
> index 0000000..981a42a
> --- /dev/null
> +++ b/programs/write_append_truncate/run_write_append_truncate.py
> @@ -0,0 +1,157 @@
> +#!/usr/bin/env python
> +#
> +#
> +# Copyright (C) 2008 Oracle. All rights reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public
> +# License as published by the Free Software Foundation; either
> +# version 2 of the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> +# General Public License for more details.
> +#
> +# You should have received a c.of the GNU General Public
> +# License along with this program; if not, write to the
> +# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +# Boston, MA 021110-1307, USA.
> +#
> +# XXX: Future improvements:
> +#
> +# Program : run_write_append_truncate.py
> +# Description : Python launcher to run write_append_truncate test.
> +# Will validate parameters and properly configure openmpi and start it.
> +# This progran will run on each node.
> +# Author : Tristan.Ye <tristan.ye at oracle.com>
> +
> +#
> +import os, stat, sys, time, optparse, socket, string, o2tf, pdb, random, config
> +#
> +#
> +DEBUGON = os.getenv('DEBUG',0)
> +#
> +uname = os.uname()
> +lhostname = str(socket.gethostname())
> +logfile = config.LOGFILE
> +procs = 1
> +cmd = config.BINDIR+'/write_append_truncate'
> +#
> +Usage = """
> +%prog
> +[-i | --iterations <iterations>]
> +[-C | --cleanup]
> +[-l | --logfile <logfile>]
> +[-n | --nodelist <nodelist>]
> +[-f | --filename <filename>]
> +[-h | --help]
> +"""
> +#
> +# FUNCTIONS
> +#
> +def Cleanup():
> + from os import access, F_OK
> + filename = options.filename
> + if access(filename,F_OK) == 1:
> + if DEBUGON:
> + o2tf.printlog('write_append_truncate: Removing filename (%s)'
> + % filename, logfile, 0, '')
> + os.system('rm -f %s' % filename)
> + sys.exit()
> +#
> +# MAIN
> +#
> +if __name__=='__main__':
> + parser = optparse.OptionParser(usage=Usage)
> +#
> + parser.add_option('-C',
> + '--cleanup',
> + action="store_true",
> + dest='cleanup',
> + default=False,
> + help='Perform directory cleanup.')
> +#
> + parser.add_option('-i',
> + '--iterations',
> + dest='iterations',
> + type='int',
> + help='Number of iterations.')
> +#
> + parser.add_option('-l',
> + '--logfile',
> + dest='logfile',
> + type='string',
> + help='Logfile used by the process.')
> +#
> + parser.add_option('-n',
> + '--nodelist',
> + dest='nodelist',
> + type='string',
> + help='List of nodes where test will run.')
> +#
> + parser.add_option('-f',
> + '--filename',
> + dest='filename',
> + type='string',
> + help='filename used by the test.')
> +#
> + (options, args) = parser.parse_args()
> + if len(args) != 0:
> + o2tf.printlog('args left %s' % len(args),
> + logfile, 0, '')
> + parser.error('incorrect number of arguments')
> +#
> +#verify args
> +#
> + if not options.filename:
> + parser.error('filename is mandatory for test')
> +
> +
> + if options.iterations:
> + nloops = str(options.iterations)
> + else:
> + nloops = ''
> +
> + if options.filename:
> + filename = options.filename
> +
> + if options.logfile:
> + logfile = options.logfile
> +
> + if options.nodelist:
> + nodelist = options.nodelist.split(',')
> + nodelen = len(nodelist)
> + procs = nodelen
> + if nodelen == 1:
> + nodelist = nodelist.append(options.nodelist)
> + else:
> + nodelist = options.nodelist.split(',')
> + else:
> + if not options.cleanup:
> + parser.error('Invalid node list.')
> +
> +if DEBUGON:
> + o2tf.printlog('write_append_truncate: main - current directory %s' %
> + os.getcwd(), logfile, 0, '')
> + o2tf.printlog('write_append_truncate: main - cmd = %s' % cmd,
> + logfile, 0, '')
> +#
> +if options.cleanup:
> + Cleanup()
> +o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
> +#
> +ret = o2tf.openmpi_run(DEBUGON, procs,
> + str('%s %s %s 2>&1 | tee -a %s' % (cmd,
> + filename,
> + nloops,
> + logfile)),
> + options.nodelist,
> + 'ssh',
> + logfile,
> + 'WAIT')
> +#
> +if not ret:
> + o2tf.printlog('write_append_truncate: main - execution successful.',
> + logfile, 0, '')
> +Cleanup()
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-tools-devel/attachments/20080918/73f53120/attachment-0001.html
More information about the Ocfs2-tools-devel
mailing list