ATLAS Offline Software
Loading...
Searching...
No Matches
makeTrfSignatures Namespace Reference

Functions

 main ()

Variables

str __doc__ = 'Dump job transform arguments into a file as a pickle'
 format
 level

Function Documentation

◆ main()

makeTrfSignatures.main ( )

Definition at line 19 of file makeTrfSignatures.py.

19def main():
20 parser = argparse.ArgumentParser(description = __doc__, )
21 parser.add_argument('--output', help='JSON output file', required = True)
22 parser.add_argument('--transforms', help='Comma separated list of transforms to process', default='all')
23 cliargs = vars(parser.parse_args())
24
25 # Make sure we can import from where the trfs actually live
26 # (N.B. This script is invoked from the cmt directory at install time)
27 sys.path.insert(1, os.path.join(os.getcwd(), '../scripts'))
28
29 myTrfSigs = {}
30 myTrfSigDesc = {}
31
32 if cliargs['transforms'] == 'all':
33 # List comprehension strips off the path and removes the .py suffix
34 # Look for all _tf.py (new style names)
35 myTrfs = [ os.path.basename(t)[:-3] for t in glob.glob('../scripts/*_tf.py') ]
36 else:
37 myTrfs = cliargs['transforms'].split(',')
38 logging.info('Will process this list of transforms: {0}'.format(' '.join(myTrfs)))
39 processedTrfs = []
40
41 for trf in myTrfs:
42 logging.info('Processing argument signatures for {0}'.format(trf))
43 # Use __import__ to allow us to import from the trf list
44 try:
45 trfModule = __import__('{0}'.format(trf), globals(), locals(), ['getTransform'], 0)
46 except ImportError:
47 logging.warning('Failed to import transform {0} - ignored'.format(trf))
48 continue
49 if 'getTransform' not in dir(trfModule):
50 logging.warning('Transform {0} has no getTransform() functionality - ignored for pickle'.format(trf))
51 continue
52 transform = trfModule.getTransform()
53 args = transform.parser.allArgs
54
55 logging.debug('Trf %s: %s', trf, args)
56 processedTrfs.append(trf)
57 myTrfSigs[trf] = args
58 myTrfSigDesc[trf] = transform.parser.getProdsysDesc
59 try:
60 logging.info('Writing JSON signatures to {0}'.format(cliargs['output']))
61 sigFile = open(cliargs['output'], 'wb')
62 json.dump(myTrfSigDesc, sigFile, indent=4)
63 except OSError as e:
64 logging.error('Failed to dump pickled signatures to %s: %s', cliargs['output'], e)
65 sys.exit(1)
66
67 logging.info('Successfully generated signature file "%s" for transforms %s', cliargs['output'], processedTrfs)
68 sys.exit(0)
69
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
int main()
Definition hello.cxx:18

Variable Documentation

◆ __doc__

str makeTrfSignatures.__doc__ = 'Dump job transform arguments into a file as a pickle'
private

Definition at line 7 of file makeTrfSignatures.py.

◆ format

makeTrfSignatures.format

Definition at line 17 of file makeTrfSignatures.py.

◆ level

makeTrfSignatures.level

Definition at line 17 of file makeTrfSignatures.py.