Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#!/usr/bin/env python3
'''Script that directs the popcon output to the condition uploader
'''
import os
import sys
from CondCore.Utilities import popcon2dropbox

import optparse
import argparse

def main( argv ):

    parser = argparse.ArgumentParser()
    parser.add_argument("job_file", type=str, help="wrapper for popcon jobs")
    parser.add_argument("-d","--destDb", type=str, help="destination database")
    parser.add_argument("-t","--destTag", type=str, help="destination database")
    parser.add_argument("-a","--auth", type=str,  help="authentication path (for conddb key and .netrc files)")
    parser.add_argument("-x","--comment", type=str, help="user comment for the upload")
    parser.add_argument('--copy', '-c', action='store_true', help='Execute the import with a direct copy.')
    args = parser.parse_args()  

    if args.job_file is None:
        print('ERROR: the cfg file name has not been provided.')
        return -1
    if not os.path.exists( args.job_file ):
        print('ERROR: the specified cfg file %s has not been found in the execution directory' %args.job_file)
        return -2
    if args.destDb is None:
        print('ERROR: the destination database has not been provided.')
        return -1        
    if args.destTag is None:
        print('ERROR: the destination tag has not been provided.')
        return -1        

    return popcon2dropbox.run( args )

if __name__ == '__main__':
    sys.exit(main(sys.argv))