Exemple #1
0
def bsub_orthology_query(cache_key, cache_file, query_kws, job_name):
    lsf_options = ['-o', '/dev/null', '-N',
                   # '-q', 'short', # short is a big queue but often busy
                   '-q', 'cbi_12h', # cbi_12h has few nodes but is rarely busy
                   '-W', '2:0',
                   '-J', job_name]
    filename = filemsg.dump({'cache_key': cache_key, 'cache_file': cache_file,
                             'query_kws': query_kws})
    cmd = cliutil.args(__file__) + ['orthquery', '--params', filename]
    return lsf.bsub(cmd, lsf_options)
Exemple #2
0
def _bsub_task(ns, task, lsfopts, devnull=True):
    '''
    Submit a task to lsf
    '''
    filename = filemsg.dump([ns, task])
    cmd = cliutil.args(__file__) + ['run_task', filename]
    devnull_option = ['-o', '/dev/null'] if devnull else []
    jobname_option = ['-J', _lsf_job_name(ns, task.name)]
    lsfopts = devnull_option + list(lsfopts) + jobname_option
    return lsf.bsub(cmd, lsfopts)
def likelihood(roi,mass_points,dry=True,ignore_batch=False,
               final_states=None,j=1.3e18,scan=False,scan_min=None,
               scan_max=None,scan_npts=20,debug=False,minos_id=19,IC=False,
               model="PS",sleep='1m',lsf_queue="bullet-xml",force_srcmap=True,
               std_diffuse=True,CR=False,update_yaml=False):
    # scan_max = 200
    # that's the drive routine
    print '*INFO* entering likelihood at %s'%str(time.ctime())
    if roi.__dict__.has_key("egal"):
        os.environ["EGAL"]=roi.egal
    if roi.__dict__.has_key("gal"):
        os.environ["GAL"]=roi.gal
    print 'GAL: %s\nEGAL: %s'%(os.getenv("GAL"),os.getenv("EGAL"))
    # pickle a dict
    fstates = ['bbar','mumu','ww','tautau']
    if not final_states is None:
        fstates = final_states
    batch_jobs = []
    if not CR:
        for f in fstates:
            tmp_masses = []
            masses = mass_points
            if IC:
                if f == "mumu": masses = mumuIC.keys()
                elif f == "ee": masses = eeIC.keys()
                #else:
                #    print '*INFO*: ignoring final state %s'%f
                #    continue
            if f == "ww":
                for m in mass_points:
                    if m>=80:
                        tmp_masses.append(m)
                masses = tmp_masses
            print '*INFO*: mass points for %s %s'%(f,str(masses))
            roi.configuration.FinalState=f
            roi.configuration.resultsfile = os.path.join(roi.configuration.my_run_dir,"outputLLH_%s_%s.pkl"%(roi.name,f))
#             d = {}
#             d_pick = pickle.dumps(d,-1)    
#             f = open(roi.configuration.resultsfile,"wb")
#             f.write(d_pick)
#             f.close()
#             del d_pick
            if not IC: chunk = pack(roi,roi.configuration,minos_id)
            #print '*INFO* packing chunk %s'%chunk
            cmds = []
            for m in masses:
                if IC: chunk = pack(roi,roi.configuration,minos_id)
                cmd = 'python fermi-virgo/base/virgo_analysis.py "runLikelihood" %s %1.8f %1.8e'%(chunk,m,j)
                if IC:                   cmd+=" --IC" # activate IC
                if scan:                 cmd+=" --scan"
                if not scan_min is None: cmd+=" --scan_min=%1.4e"%float(scan_min)
                if not scan_max is None: cmd+=" --scan_max=%1.4e"%float(scan_max)
                if not scan_npts is None:cmd+=" --scan_npts=%i"%int(scan_npts)
                if not std_diffuse: cmd+=" --no-std-diffuse"
                if update_yaml: cmd+=" --update-yaml"
                cmds.append(cmd)
            # build the job-array:
            jobname = "Likelihood_%s_%s_%s"%(model,roi.name,roi.configuration.FinalState)
            lsf.bsub(jobname, cmds, logfiles=None,submit=not(dry), sleep=sleep,q=lsf_queue)#"bullet-xxl")
    else:
        cmds = []
        roi.configuration.FinalState= "CR"
        roi.configuration.resultsfile = os.path.join(roi.configuration.my_run_dir,"outputLLH_%s_%s.pkl"%(roi.name,"CR"))
#         d = {}
#         d_pick = pickle.dumps(d,-1)    
#         f = open(roi.configuration.resultsfile,"wb")
#         f.write(d_pick)
#         f.close()
#         del d_pick
        chunk = pack(roi,roi.configuration,minos_id)
        print '*INFO* packing chunk %s'%chunk
        cmd = 'python fermi-virgo/base/virgo_analysis.py "runLikelihoodCR" %s %1.8f %1.8e'%(chunk,100.,j)
        if scan:                 cmd+=" --scan"
        if not scan_min is None: cmd+=" --scan_min=%1.4e"%float(scan_min)
        if not scan_max is None: cmd+=" --scan_max=%1.4e"%float(scan_max)
        if not scan_npts is None:cmd+=" --scan_npts=%i"%int(scan_npts)
        if not std_diffuse: cmd+=" --no-std-diffuse"
        if update_yaml: cmd+=" --update-yaml"

        print '*INFO* cmd to add to array: %s'%cmd
        cmds.append(cmd)
        # build the job-array:
        jobname = "Likelihood_%s_%s_%s"%(model,roi.name,roi.configuration.FinalState)
        lsf.bsub(jobname, cmds, logfiles=None,submit=not(dry), sleep=sleep,q=lsf_queue)#"bullet-xxl")