| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Functions | Variables
gaudirun Namespace Reference

## Classes
class | FakeModule

## Functions
def | getArgsWithoutoProfilerInfo (args)
def | setLibraryPreload (newpreload)
def | rationalizepath (path)
def | getArgsFromQmt (qmtfile)
def | option_cb (option, opt, value, parser)

## Variables
list | _qmt_tmp_opt_files = []
| parser = OptionParser(usage = "%prog [options] <opts_file> ...")
| action
| help
| type
| metavar
| default
| callback
| nargs
| dest
| options = [ "importOptions(%r)" % f for f in args ]
| tcmalloc
| profilerName = opts.profilerName
| profilerOutput = opts.profilerOutputor(profilerName + ".output")
| profilerExtraOptions = opts.profilerExtraOptions
| preload = os.environ.get("LD_PRELOAD", "")
| ncpus
| old_conf_user_apply
| run_info_file
list | argv = []
| opts
| args = [ a for a in sys.argv if a != '-T' and not '--tcmalloc'.startswith(a) ]
| sys_cpus = cpu_count()
string | s = "Invalid value : --ncpus : only %i cpus available"
| prefix
| level = logging.INFO
| with_time
| root_logger = logging.getLogger()
list | to_load
string | profilerExecName = ""
string | igprofPerfOptions = "-d -pp -z -o igprof.pp.gz"
string | profilerOptions = ""
| toolname = profilerName.replace('valgrind','')
string | outoption = "--log-file"
| profilerPath = distutils.spawn.find_executable(profilerExecName)
list | to_reload = []
list | arglist = [profilerPath]+profilerOptions.split()+args
| output
| c = gaudimain()
| optlines = list(opts.options)
dictionary | g = {}
dictionary | l = {}
| _appliedConfigurableUsers_
| use_temp_opts
| fd
| tmpfile
| printsequence
| retcode = c.run(opts.gdb,opts.ncpus)
dictionary | run_info = {}

## Function Documentation

def gaudirun.getArgsFromQmt | ( |  | qmtfile | ) |

    Given a .qmt file, return the command line arguments of the corresponding
    test.

Definition at line 71 of file gaudirun.py.

71 def getArgsFromQmt(qmtfile):
72 '''
73 Given a .qmt file, return the command line arguments of the corresponding
74 test.
75 '''
76 from xml.etree import ElementTree as ET
77 global _qmt_tmp_opt_files
78 # parse the .qmt file and extract args and options
79 qmt = ET.parse(qmtfile)
80 args = [a.text for a in qmt.findall("argument[@name='args']//text")]
81 options = qmt.find("argument[@name='options']/text")
82
83 if options is not None: # options need to be dumped in a temporary file
84 from tempfile import NamedTemporaryFile
85 import re
86 if re.search(r"from\s+Gaudi.Configuration\s+import\s+\*"
87 r"|from\s+Configurables\s+import", options.text):
88 tmp_opts = NamedTemporaryFile(suffix='.py')
89 else:
90 tmp_opts = NamedTemporaryFile(suffix='.opts')
91 tmp_opts.write(options.text)
92 tmp_opts.flush()
93 args.append(tmp_opts.name)
94 _qmt_tmp_opt_files.append(tmp_opts)
95
96 # relative paths in a .qmt are rooted in the qmtest directory, so
97 # - find where the .qmt lives
98 qmtfile = os.path.abspath(qmtfile)
99 if 'qmtest' in qmtfile.split(os.path.sep):
100 # this return the path up to the 'qmtest' entry in qmtfile
101 testdir = qmtfile
102 while os.path.basename(testdir) != 'qmtest':
103 testdir = os.path.dirname(testdir)
104 else:
105 testdir = '.'
106 # - temporarily switch to that directory and rationalize the paths
107 old_cwd = os.getcwd()
108 os.chdir(testdir)
109 args = map(rationalizepath, args)
110 os.chdir(old_cwd)
111
112 return args
113
114 #---------------------------------------------------------------------
gaudirun.getArgsFromQmt
def getArgsFromQmt(qmtfile)
Definition: gaudirun.py:71
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:25

def gaudirun.getArgsWithoutoProfilerInfo | ( |  | args | ) |

    Remove from the arguments the presence of the profiler and its output in
    order to relaunch the script w/o infinite loops.

    >>> getArgsWithoutoProfilerInfo(['--profilerName', 'igprof', 'myopts.py'])
    ['myopts.py']

    >>> getArgsWithoutoProfilerInfo(['--profilerName=igprof', 'myopts.py'])
    ['myopts.py']

    >>> getArgsWithoutoProfilerInfo(['--profilerName', 'igprof', '--profilerExtraOptions', 'a b c', 'myopts.py'])
    ['myopts.py']

    >>> getArgsWithoutoProfilerInfo(['--profilerName', 'igprof', '--options', 'a b c', 'myopts.py'])
    ['--options', 'a b c', 'myopts.py']

Definition at line 7 of file gaudirun.py.

7 def getArgsWithoutoProfilerInfo(args):
8 """
9 Remove from the arguments the presence of the profiler and its output in
10 order to relaunch the script w/o infinite loops.
11
12 >>> getArgsWithoutoProfilerInfo(['--profilerName', 'igprof', 'myopts.py'])
13 ['myopts.py']
14
15 >>> getArgsWithoutoProfilerInfo(['--profilerName=igprof', 'myopts.py'])
16 ['myopts.py']
17
18 >>> getArgsWithoutoProfilerInfo(['--profilerName', 'igprof', '--profilerExtraOptions', 'a b c', 'myopts.py'])
19 ['myopts.py']
20
21 >>> getArgsWithoutoProfilerInfo(['--profilerName', 'igprof', '--options', 'a b c', 'myopts.py'])
22 ['--options', 'a b c', 'myopts.py']
23 """
24 newargs = []
25 args = list(args) # make a temp copy
26 while args:
27 o = args.pop(0)
28 if o.startswith('--profile'):
29 if '=' not in o:
30 args.pop(0)
31 else:
32 newargs.append(o)
33 return newargs
34
gaudirun.getArgsWithoutoProfilerInfo
def getArgsWithoutoProfilerInfo(args)
Definition: gaudirun.py:7

def gaudirun.option_cb | ( |  | option,
|  |  | opt,
|  |  | value,
|  |  | parser
| ) |  |

    Add the option line to a list together with its position in the
    argument list.

Definition at line 145 of file gaudirun.py.

145 def option_cb(option, opt, value, parser):
146 """Add the option line to a list together with its position in the
147 argument list.
148 """
149 parser.values.options.append((len(parser.largs), value))
gaudirun.option_cb
def option_cb(option, opt, value, parser)
Definition: gaudirun.py:145

def gaudirun.rationalizepath | ( |  | path | ) |

    Convert the given path to a real path if the pointed file exists, otherwise
    just normalize it.

Definition at line 59 of file gaudirun.py.

59 def rationalizepath(path):
60 '''
61 Convert the given path to a real path if the pointed file exists, otherwise
62 just normalize it.
63 '''
64 path = os.path.normpath(os.path.expandvars(path))
65 if os.path.exists(path):
66 path = os.path.realpath(path)
67 return path
68
69 # variable used to keep alive the temporary option files extracted from the .qmt
gaudirun.rationalizepath
def rationalizepath(path)
Definition: gaudirun.py:59

def gaudirun.setLibraryPreload | ( |  | newpreload | ) |

    Adds  a list of libraries to LD_PRELOAD

Definition at line 35 of file gaudirun.py.

35 def setLibraryPreload(newpreload):
36 ''' Adds a list of libraries to LD_PRELOAD '''
37 preload = os.environ.get("LD_PRELOAD", "")
38 if preload:
39 preload = preload.replace(" ", ":").split(":")
40 else:
41 preload = []
42
43 for libname in set(preload).intersection(newpreload):
44 logging.warning("Ignoring preload of library %s because it is "
45 "already in LD_PRELOAD.", libname)
46
47 to_load = [libname
48 for libname in newpreload
49 if libname not in set(preload)]
50
51 if to_load:
52 preload += to_load
53 preload = ":".join(preload)
54 os.environ["LD_PRELOAD"] = preload
55 logging.info("Setting LD_PRELOAD='%s'", preload)
56
57 return to_load
58
gaudirun.setLibraryPreload
def setLibraryPreload(newpreload)
Definition: gaudirun.py:35

## Variable Documentation

gaudirun._appliedConfigurableUsers_
| private

Definition at line 431 of file gaudirun.py.

list gaudirun._qmt_tmp_opt_files = []
| private

Definition at line 70 of file gaudirun.py.

gaudirun.action

Definition at line 123 of file gaudirun.py.

list gaudirun.arglist = [profilerPath]+profilerOptions.split()+args

Definition at line 370 of file gaudirun.py.

list gaudirun.args = [ a for a in sys.argv if a != '-T' and not '--tcmalloc'.startswith(a) ]

Definition at line 236 of file gaudirun.py.

list gaudirun.argv = []

Definition at line 227 of file gaudirun.py.

gaudirun.c = gaudimain()

Definition at line 391 of file gaudirun.py.

gaudirun.callback

Definition at line 150 of file gaudirun.py.

gaudirun.default

Definition at line 141 of file gaudirun.py.

gaudirun.dest

Definition at line 162 of file gaudirun.py.

gaudirun.fd

Definition at line 459 of file gaudirun.py.

dictionary gaudirun.g = {}

Definition at line 420 of file gaudirun.py.

gaudirun.help

Definition at line 124 of file gaudirun.py.

string gaudirun.igprofPerfOptions = "-d -pp -z -o igprof.pp.gz"

Definition at line 302 of file gaudirun.py.

dictionary gaudirun.l = {}

Definition at line 421 of file gaudirun.py.

gaudirun.level = logging.INFO

Definition at line 261 of file gaudirun.py.

gaudirun.metavar

Definition at line 126 of file gaudirun.py.

gaudirun.nargs

Definition at line 151 of file gaudirun.py.

gaudirun.ncpus

Definition at line 221 of file gaudirun.py.

gaudirun.old_conf_user_apply

Definition at line 223 of file gaudirun.py.

list gaudirun.options = [ "importOptions(%r)" % f for f in args ]

Definition at line 215 of file gaudirun.py.

gaudirun.optlines = list(opts.options)

Definition at line 399 of file gaudirun.py.

gaudirun.opts

Definition at line 236 of file gaudirun.py.

string gaudirun.outoption = "--log-file"

Definition at line 328 of file gaudirun.py.

gaudirun.output

Definition at line 388 of file gaudirun.py.

gaudirun.parser = OptionParser(usage = "%prog [options] <opts_file> ...")

Definition at line 122 of file gaudirun.py.

gaudirun.prefix

Definition at line 259 of file gaudirun.py.

string gaudirun.preload = os.environ.get("LD_PRELOAD", "")

Definition at line 220 of file gaudirun.py.

gaudirun.printsequence

Definition at line 466 of file gaudirun.py.

string gaudirun.profilerExecName = ""

Definition at line 296 of file gaudirun.py.

gaudirun.profilerExtraOptions = opts.profilerExtraOptions

Definition at line 219 of file gaudirun.py.

gaudirun.profilerName = opts.profilerName

Definition at line 217 of file gaudirun.py.

string gaudirun.profilerOptions = ""

Definition at line 304 of file gaudirun.py.

gaudirun.profilerOutput = opts.profilerOutputor(profilerName + ".output")

Definition at line 218 of file gaudirun.py.

gaudirun.profilerPath = distutils.spawn.find_executable(profilerExecName)

Definition at line 349 of file gaudirun.py.

gaudirun.retcode = c.run(opts.gdb,opts.ncpus)

Definition at line 478 of file gaudirun.py.

gaudirun.root_logger = logging.getLogger()

Definition at line 265 of file gaudirun.py.

dictionary gaudirun.run_info = {}

Definition at line 484 of file gaudirun.py.

gaudirun.run_info_file

Definition at line 224 of file gaudirun.py.

string gaudirun.s = "Invalid value : --ncpus : only %i cpus available"

Definition at line 245 of file gaudirun.py.

gaudirun.sys_cpus = cpu_count()

Definition at line 243 of file gaudirun.py.

gaudirun.tcmalloc

Definition at line 216 of file gaudirun.py.

gaudirun.tmpfile

Definition at line 459 of file gaudirun.py.

list gaudirun.to_load

Initial value:
1 = [libname
2 for libname in opts.preload
3 if libname not in set(preload)]

Definition at line 280 of file gaudirun.py.

gaudirun.to_reload = []

Definition at line 361 of file gaudirun.py.

gaudirun.toolname = profilerName.replace('valgrind','')

Definition at line 327 of file gaudirun.py.

gaudirun.type

Definition at line 125 of file gaudirun.py.

gaudirun.use_temp_opts

Definition at line 451 of file gaudirun.py.

gaudirun.with_time

Definition at line 264 of file gaudirun.py.