ATLAS Offline Software
Loading...
Searching...
No Matches
GetTfCommand.py
Go to the documentation of this file.
1#!/usr/bin/env python
2
3# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4
5
6
7import sys
8import argparse
9
10from PyJobTransforms.trfLogger import msg, stdLogLevels
11if '--printOnlyCmdLine' not in sys.argv:
12 msg.info('logging set in %s', sys.argv[0])
13
14from PyJobTransforms.trfAMI import TagInfo
15from PyJobTransforms.trfExceptions import TransformAMIException
16
17def main():
18 parser = argparse.ArgumentParser(argument_default = argparse.SUPPRESS, description = 'GetTfCommand.py - prints the job transform commands accociated with an AMI tag.')
19 parser.add_argument('--AMI', '--AMIConfig', help = 'Production tag to be interpreted', required = True)
20 parser.add_argument('--verbose', '--debug', action = 'store_true', help = 'set logging level to DEBUG')
21 parser.add_argument('--doNotSuppressNonJobOptions', action = 'store_true', help = 'get full output from AMI')
22 parser.add_argument('--printOnlyCmdLine', action = 'store_true', help = 'simply put out the TRF command line, nothing else')
23
24 args = vars(parser.parse_args(sys.argv[1:]))
25
26 if 'verbose' in args:
27 msg.setLevel(stdLogLevels['DEBUG'])
28
29 suppressNonJobOptions = True
30 if 'doNotSuppressNonJobOptions' in args:
31 suppressNonJobOptions = False
32
33 try:
34 tag = TagInfo(args['AMI'], suppressNonJobOptions)
35 except TransformAMIException as e:
36 print('An AMI exception was raised when trying to resolve the tag {0}.'.format(args['AMI']))
37 print('Exception message was: {0}'.format(e.errMsg))
38 print('Note that you need both suitable credentials to access AMI and access to the panda database (only works from inside CERN) for GetTfCommand.py to work.')
39 sys.exit(1)
40
41 if 'printOnlyCmdLine' not in args:
42 print(tag)
43
44 if 'argdict' in args:
45 tag.dump(args['argdict'])
46 else:
47 # only print the command line, allows stuff like
48 # pathena --trf "`GetTfCommand --AMI q1234 --printOnlyCmdLine` --inputFile bla.input --maxEvents 42"
49 trfCmdLine = tag.trfs[0].name + " " + tag.trfs[0]._argsToString(tag.trfs[0].physics)
50 print(trfCmdLine.replace('"', '\\' + '"'))
51
52
53if __name__ == '__main__':
54 main()
55
void print(char *figname, TCanvas *c1)
This class contains the list of currently valid tags for detector description - GeoModel and IOV/Cond...
Definition TagInfo.h:41
Utilities for configuration of transforms via AMI tags.
Logging configuration for ATLAS job transforms.