Пример #1
0
def check_output_file(options):  
    '''Check root file for TTree entries
    '''
    # Can only check the outputs for files with output file specified in the command options
    if options.output_file is None:
        print "check_output_file::no output file specified"
        return None

    # Can only check the outputs for files with number of events specified in the command options
    if options.n_events is None:
        print "check_output_file::no number of events specified"
        return None

    # Create command to run python script to check TTree entries
    # Will raise an exception if the checks fail
    ntuple = job_tools.check_processor(options.rat_macro, 'outntuple')
    root = job_tools.check_processor(options.rat_macro, 'outroot')
    soc = job_tools.check_processor(options.rat_macro, 'outsoc')
    if root or soc:
        rtc, out, err = job_tools.execute_ratenv('python', ['check_root_output.py', '-f', '%s.root' % options.output_file,
                                                        '-n', options.n_events, '-v', options.base_version])
        if rtc==0:
            # this must be true (exception raised otherwise)
            print "Outputs file checks successful"
    if ntuple:
        rtc, out, err = job_tools.execute_ratenv('python', ['check_root_output.py', '-f', '%s.ntuple.root' % options.output_file,
                                                        '-n', options.n_events, '-v', options.base_version])
        if rtc==0:
            # this must be true (exception raised otherwise)
            print "Outputs file checks successful"
Пример #2
0
def run_rat(options):
    '''Run the RAT macro
    '''
    rat_options = ['-l', 'rat.log']
    if options.dbuser and options.dbpassword and options.dbname and options.dbprotocol and options.dburl:
        rat_options += ['-b', '%s://%s:%s@%s/%s' % (options.dbprotocol, options.dbuser, options.dbpassword,
                                                    options.dburl, options.dbname)]
    rat_options += [options.rat_macro]
    # Will exit if command fails
    job_tools.execute_ratenv('rat', rat_options)
Пример #3
0
def run_rat(options):
    '''Run the RAT macro
    '''
    rat_options = ['-l', 'rat.log']
    if options.dbuser and options.dbpassword and options.dbname and options.dbprotocol and options.dburl:
        rat_options += [
            '-b',
            '%s://%s:%s@%s/%s' %
            (options.dbprotocol, options.dbuser, options.dbpassword,
             options.dburl, options.dbname)
        ]
    rat_options += [options.rat_macro]
    # Will exit if command fails
    job_tools.execute_ratenv('rat', rat_options)
Пример #4
0
def run_rat(options):
    '''Run RAT according to the options.
    '''
    rat_options = ['-l', 'rat.log']
    if options.input_file:
        rat_options += ['-i', options.input_file]
    if options.output_file:
        rat_options += ['-o', options.output_file]
    if options.n_events:
        rat_options += ['-N', options.n_events]
    elif options.run_time:
        rat_options += ['-T', options.run_time]
    if options.dbuser and options.dbpassword and options.dbname and options.dbprotocol and options.dburl:
        rat_options += ['-b', '%s://%s:%s@%s/%s' % (options.dbprotocol, options.dbuser, options.dbpassword,
                                                    options.dburl, options.dbname)]
    rat_options += [options.rat_macro]
    job_tools.execute_ratenv('rat', rat_options)    
    print os.listdir(os.getcwd())
Пример #5
0
def run_rat(options):
    '''Run RAT according to the options.
    '''
    rat_options = ['-l', 'rat.log']
    if options.input_file:
        rat_options += ['-i', options.input_file]
    if options.output_file:
        rat_options += ['-o', options.output_file]
    if options.n_events:
        rat_options += ['-N', options.n_events]
    elif options.run_time:
        rat_options += ['-T', options.run_time]
    if options.dbuser and options.dbpassword and options.dbname and options.dbprotocol and options.dburl:
        rat_options += [
            '-b',
            '%s://%s:%s@%s/%s' %
            (options.dbprotocol, options.dbuser, options.dbpassword,
             options.dburl, options.dbname)
        ]
    rat_options += [options.rat_macro]
    job_tools.execute_ratenv('rat', rat_options)
    print os.listdir(os.getcwd())
Пример #6
0
def check_output_file(options):
    '''Check root file for TTree entries
    '''
    # Can only check the outputs for files with output file specified in the command options
    if options.output_file is None:
        print "check_output_file::no output file specified"
        return None

    # Can only check the outputs for files with number of events specified in the command options
    if options.n_events is None:
        print "check_output_file::no number of events specified"
        return None

    # Create command to run python script to check TTree entries
    # Will raise an exception if the checks fail
    ntuple = job_tools.check_processor(options.rat_macro, 'outntuple')
    root = job_tools.check_processor(options.rat_macro, 'outroot')
    soc = job_tools.check_processor(options.rat_macro, 'outsoc')
    if root or soc:
        rtc, out, err = job_tools.execute_ratenv('python', [
            'check_root_output.py', '-f',
            '%s.root' % options.output_file, '-n', options.n_events, '-v',
            options.base_version
        ])
        if rtc == 0:
            # this must be true (exception raised otherwise)
            print "Outputs file checks successful"
    if ntuple:
        rtc, out, err = job_tools.execute_ratenv('python', [
            'check_root_output.py', '-f',
            '%s.ntuple.root' % options.output_file, '-n', options.n_events,
            '-v', options.base_version
        ])
        if rtc == 0:
            # this must be true (exception raised otherwise)
            print "Outputs file checks successful"
Пример #7
0
def run_script(prod_script):
    '''Just run a production script, within the rat environment (as setup by job_helper)
    '''
    job_tools.execute_ratenv('/bin/bash', prod_script)
Пример #8
0
def run_script(prod_script):
    '''Just run a production script, within the rat environment (as setup by job_helper)
    '''
    job_tools.execute_ratenv('/bin/bash', prod_script)