11 if '--printOnlyCmdLine' not in sys.argv:
12 msg.info(
'logging set in %s', sys.argv[0])
15 from PyJobTransforms.trfExceptions
import TransformAMIException
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')
24 args = vars(parser.parse_args(sys.argv[1:]))
27 msg.setLevel(stdLogLevels[
'DEBUG'])
29 suppressNonJobOptions =
True
30 if 'doNotSuppressNonJobOptions' in args:
31 suppressNonJobOptions =
False
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.')
41 if 'printOnlyCmdLine' not in args:
45 tag.dump(args[
'argdict'])
49 trfCmdLine = tag.trfs[0].name +
" " + tag.trfs[0]._argsToString(tag.trfs[0].physics)
50 print(trfCmdLine.replace(
'"',
'\\' +
'"'))
53 if __name__ ==
'__main__':