Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ExeWrap_tf.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
4 
5 
8 
9 import sys
10 import time
11 
12 # Setup core logging here
13 from PyJobTransforms.trfLogger import msg
14 msg.info('logging set in %s', sys.argv[0])
15 
16 from PyJobTransforms.transform import transform
17 from PyJobTransforms.trfExe import scriptExecutor
18 import PyJobTransforms.trfArgClasses as trfArgClasses
19 from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace
20 
21 @stdTrfExceptionHandler
22 @sigUsrStackTrace
23 def main():
24 
25  msg.info('This is %s', sys.argv[0])
26 
27  trf = getTransform()
28  trf.parseCmdLineArgs(sys.argv[1:])
29 
30  # Need to update what we want to execute after the command line is parsed
31  # LHS is the slightly convoluted way to get at the single member of a set
32  # (which, of course, itself has no index)
33  list(trf._executors)[0].exe = trf.argdict['exe'].value
34 
35  trf.execute()
36  trf.generateReport()
37 
38  msg.info("%s stopped at %s, trf exit code %d", sys.argv[0], time.asctime(), trf.exitCode)
39  sys.exit(trf.exitCode)
40 
42  trf = transform(executor = scriptExecutor(name = 'ExeWrap', exe = None, exeArgs = ['args']))
43  addMyArgs(trf.parser)
44  return trf
45 
46 
47 def addMyArgs(parser):
48  # Use arggroup to get these arguments in their own sub-section (of --help)
49  parser.defineArgGroup('ExeWrap_trf', 'ExeWrap_trf specific options')
50  parser.add_argument('--exe', type=trfArgClasses.argFactory(trfArgClasses.argString),
51  group='ExeWrap_trf', help='Executable to invoke')
52  parser.add_argument('--args', type=trfArgClasses.argFactory(trfArgClasses.argList), nargs='+',
53  group='ExeWrap_trf', help='Additonal parameters to the executor')
54 
55 
56 if __name__ == '__main__':
57  main()
PyJobTransforms.trfArgClasses
Transform argument class definitions.
ExeWrap_tf.getTransform
def getTransform()
Definition: ExeWrap_tf.py:41
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
ExeWrap_tf.addMyArgs
def addMyArgs(parser)
Example of how to add some specific arguments to the transform.
Definition: ExeWrap_tf.py:47
PyJobTransforms.trfExe
Transform execution functions.
PyJobTransforms.trfLogger
Logging configuration for ATLAS job transforms.
PyJobTransforms.transform
Main package for new style ATLAS job transforms.
ExeWrap_tf.main
def main()
Definition: ExeWrap_tf.py:23