ATLAS Offline Software
Loading...
Searching...
No Matches
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
9import sys
10import time
11
12# Setup core logging here
13from PyJobTransforms.trfLogger import msg
14msg.info('logging set in %s', sys.argv[0])
15
16from PyJobTransforms.transform import transform
17from PyJobTransforms.trfExe import scriptExecutor
18import PyJobTransforms.trfArgClasses as trfArgClasses
19from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace
20
21@stdTrfExceptionHandler
22@sigUsrStackTrace
23def 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
47def 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
56if __name__ == '__main__':
57 main()
addMyArgs(parser)
Example of how to add some specific arguments to the transform.
Definition ExeWrap_tf.py:47
Main package for new style ATLAS job transforms.
Transform argument class definitions.
Transform execution functions.
Logging configuration for ATLAS job transforms.