コード例 #1
0
ファイル: collect.py プロジェクト: radziej/findsusyb3
def resubmit(filename, period):
    global options
    basedir = ara.config.get('Analysis', 'basedir')
    myDir = basedir + '/' + options.selection + '/' + period
    os.chdir(myDir)
    condor_jobfile = myDir+'/'+filename+"_condor.cfg"
    ara.wait_for_jobs(options.njobs)
    print "Resubmitting", condor_jobfile
    rc = ara.getCommandOutput2("condor_submit " + condor_jobfile)
    return rc
コード例 #2
0
ファイル: submit.py プロジェクト: radziej/findsusyb3
def submit_condor_job(executable, arguments, inbox, outbox, jobname):
    global options
    scriptdir = os.environ['ARASYS'] + '/config'
    condor_template_file = open(scriptdir + '/' + options.template)
    condor_template = condor_template_file.read()
    stderr = "_".join((jobname, "stderr.log"))
    stdout = "_".join((jobname, "stdout.log"))
    cfgFile = "_".join((jobname, "condor.cfg"))
    repMap = {}
    repMap["executable"] = executable
    repMap["arguments"] = arguments
    repMap["inputfiles"] = inbox
    repMap["stdout"] = stdout
    repMap["stderr"] = stderr
    repMap["log"] = "condor.log"
    repMap["outputfiles"] = outbox
    content = condor_template % repMap
    jobfile = open(cfgFile, "w")
    jobfile.write(content)
    jobfile.close()
    ara.wait_for_jobs(ara.get_maximum_jobs(options.njobs))
    rc = ara.getCommandOutput2("condor_submit " + cfgFile)
    return rc
コード例 #3
0
ファイル: tightloose.py プロジェクト: radziej/findsusyb3
def main():
    usage = """

%prog [-b] [-t] configfile

Batch submission of default job, creation of FakeRate file, submission of fake rate jobs."""
    optParser = optparse.OptionParser(usage)
    optParser.add_option("-c", "--config", dest="cfgfile",
                         help="global ARA configuration file",
                         default=ara.defaultConfigFileName)
    optParser.add_option("-t", "--tight-lose-ratio", action="store_true",
                         dest="tlratio",
                         help="compute T/L ratio")
    optParser.add_option("-b", "--submit-base", action="store_true",
                         dest="submitbase",
                         help="submit the base version, too, not only single+double fakes (implies -t)")


    global options
    (options, args) = optParser.parse_args()
    if len(args) < 1 or len(args) > 1:
        optParser.print_help()
        return 1

    basename = args[0]
    basepath = os.environ["ARASYS"]+"/config/analyzer_"+basename
    templateFileName = basepath+".cfg"

    # Check if template file exists
    if not os.path.isfile(templateFileName):
        print "File "+templateFileName+" not found. Exiting."
        return 2

    # Check if base job needs to be submitted
    if (options.submitbase):
        os.system("submit.py -n 30 -a %s" % ( basename ))
        # wait until all jobs are terminated
        ara.wait_for_jobs(0)
        # check and resubmit if necessary
        os.system("collect.py -r %s " % (basename))
        # wait until all jobs are terminated
        ara.wait_for_jobs(0)

    if (options.tlratio or options.submitbase):
        # create fakerate file
        opwd = os.getcwd()
        os.chdir(os.environ["ARASYS"]+"/root")
        os.system("root -q -b 'tlratio.C(\"%s\")'" % basename)
        os.chdir(opwd)

    # Create descendent configuration file (singlefake)
    repMap = { }
    repMap["AnalysisType = \"default\""] = "AnalysisType = \"singlefake\""
    repMap["FakeRateFile = \"FakeRate.root\""] = "FakeRateFile = \"FakeRate_%s.root\"" % ( basename )
    destination = basepath+"_singlefake.cfg"
    ara.create_config_file(templateFileName, repMap, destination)

    # submit
    os.system("submit.py -n 30 -a %s_singlefake" % basename)

    # Create descendent configuration file (doublefake)
    repMap["AnalysisType = \"default\""] = "AnalysisType = \"doublefake\""
    repMap["FakeRateFile = \"FakeRate.root\""] = "FakeRateFile = \"FakeRate_%s.root\"" % ( basename )
    destination = basepath+"_doublefake.cfg"
    ara.create_config_file(templateFileName, repMap, destination)

    # submit
    os.system("submit.py -n 30 -a %s_doublefake" % basename)

    # wait for jobs to finish and collect jobs
    ara.wait_for_jobs(0)
    os.system("collect.py -r %s_singlefake" % basename)
    os.system("collect.py -r %s_doublefake" % basename)