Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Echo_tf.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 
5 
7 
8 import sys
9 import time
10 
11 # Setup core logging here
12 from PyJobTransforms.trfLogger import msg
13 msg.info('logging set in %s', sys.argv[0])
14 
15 from PyJobTransforms.transform import transform
16 from PyJobTransforms.trfExe import echoExecutor
17 from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace
18 
19 import PyJobTransforms.trfArgs as trfArgs
20 import PyJobTransforms.trfArgClasses as trfArgClasses
21 
22 # Always embed your transform inside a top level exception
23 # handler. This ensures that uncaught exceptions are handled
24 # with a modicum of decency and that the transform has the
25 # chance to produce a job report and a sensible exit code.
26 # These decorators do this.
27 @stdTrfExceptionHandler
28 @sigUsrStackTrace
29 def main():
30 
31  msg.info('This is %s', sys.argv[0])
32 
33  trf = getTransform()
34 
35  trf.parseCmdLineArgs(sys.argv[1:])
36  trf.execute()
37  trf.generateReport()
38 
39  msg.info("%s stopped at %s, transform exit code %d", sys.argv[0], time.asctime(), trf.exitCode)
40  sys.exit(trf.exitCode)
41 
43  trf = transform(executor = echoExecutor())
44  addMyArgs(trf.parser)
45  trfArgs.addTeaArguments(trf.parser)
46  trfArgs.addAthenaArguments(trf.parser)
47  return trf
48 
49 
50 
51 def addMyArgs(parser):
52  # Use arggroup to get these arguments in their own sub-section (of --help)
53  parser.defineArgGroup('Echo_trf', 'Echo_trf specific options')
54  parser.add_argument('--testInt', group='Echo_trf', type=trfArgClasses.argFactory(trfArgClasses.argInt), help='An integer')
55  parser.add_argument('--testFloat', group='Echo_trf', type=trfArgClasses.argFactory(trfArgClasses.argFloat), help='A float')
56  parser.add_argument('--testList', group='Echo_trf',
57  type=trfArgClasses.argFactory(trfArgClasses.argList), help='A string list', nargs='+')
58  parser.add_argument('--testIntList', group='Echo_trf', nargs='+',
59  type=trfArgClasses.argFactory(trfArgClasses.argIntList), help='A int list')
60  parser.add_argument('--testFile', group='Echo_trf', nargs='+',
61  type=trfArgClasses.argFactory(trfArgClasses.argFile, io='input'), help='Test file(s)')
62  parser.add_argument('--testSubstepList', group='Echo_trf', nargs='+',
63  type=trfArgClasses.argFactory(trfArgClasses.argSubstepList), help='A substep list')
64  parser.add_argument('--testSubstepInt', group='Echo_trf', nargs='+',
65  type=trfArgClasses.argFactory(trfArgClasses.argSubstepInt), help='A substep int')
66  parser.add_argument('--testSubstepBool', group='Echo_trf', nargs='+',
67  type=trfArgClasses.argFactory(trfArgClasses.argSubstepBool), help='A substep bool')
68 
69 
70 
71 if __name__ == '__main__':
72  main()
Echo_tf.getTransform
def getTransform()
Definition: Echo_tf.py:42
PyJobTransforms.trfArgClasses
Transform argument class definitions.
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
PyJobTransforms.trfExe
Transform execution functions.
Echo_tf.main
def main()
Definition: Echo_tf.py:29
PyJobTransforms.trfLogger
Logging configuration for ATLAS job transforms.
PyJobTransforms.transform
Main package for new style ATLAS job transforms.
Echo_tf.addMyArgs
def addMyArgs(parser)
Example of how to add some specific arguments to the transform.
Definition: Echo_tf.py:51