ATLAS Offline Software
Archive_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 archiveExecutor
17 from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace
18 
19 import PyJobTransforms.trfArgClasses as trfArgClasses
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  trf.execute()
30  trf.generateReport()
31 
32  msg.info("%s stopped at %s, trf exit code %d", sys.argv[0], time.asctime(), trf.exitCode)
33  sys.exit(trf.exitCode)
34 
36  executorSet = set()
37  executorSet.add(archiveExecutor(name = 'Archiver', exe = 'zip', inData = ['Data'], outData = ['Arch']))
38  executorSet.add(archiveExecutor(name = 'Unarchiver', exe = 'unarchive', inData = ['Arch'], outData = ['outNULL']))
39 
40  trf = transform(executor = executorSet)
41  addMyArgs(trf.parser)
42  return trf
43 
44 
45 def addMyArgs(parser):
46  # Use arggroup to get these arguments in their own sub-section (of --help)
47  parser.defineArgGroup('Archiver', 'Options')
48  parser.defineArgGroup('Unarchiver', 'Options')
49  parser.add_argument('--inputDataFile', '--inputFile', nargs='+',
50  type=trfArgClasses.argFactory(trfArgClasses.argFile, io='input', type='misc'),
51  help='Input file(s)', group='Archiver')
52  parser.add_argument('--inputArchFile',
53  type=trfArgClasses.argFactory(trfArgClasses.argFile, io='input', type='misc'),
54  help='Input archive file', group='Unarchiver')
55  parser.add_argument('--path', group='Unarchiver',
56  help='Specifies a different directory to extract to. The default is the current working directory', default='.')
57  parser.add_argument('--outputArchFile', '--outputFile',
58  type=trfArgClasses.argFactory(trfArgClasses.argFile, io='output', type='misc'),
59  help='Output archive file', group='Archiver')
60 
61 if __name__ == '__main__':
62  main()
PyJobTransforms.trfArgClasses
Transform argument class definitions.
Archive_tf.addMyArgs
def addMyArgs(parser)
Definition: Archive_tf.py:45
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
Archive_tf.main
def main()
Definition: Archive_tf.py:23
PyJobTransforms.trfExe
Transform execution functions.
PyJobTransforms.trfLogger
Logging configuration for ATLAS job transforms.
PyJobTransforms.transform
Main package for new style ATLAS job transforms.
Archive_tf.getTransform
def getTransform()
Definition: Archive_tf.py:35