Beispiel #1
0
def submit(qjobname,ncore,infile,amp_job,nHL,elimit,flimit,mem,ntotal,ntr,ntype,nlist):
    pwd = os.getcwd()
    str_hl = " ".join(str(x) for x in nHL)
    #if yes_or_no("run ?"):
    #jobdir = make_dir(nHL, elimit)
    if elimit == 0.0:
        elimit=int(elimit)
    if flimit == 0.0:
        flimit=int(flimit)
    ### Make directory name!!
    #jobdir = 'HL'+list2str(nHL)+'E'+str(elimit)+'F'+str(flimit)
    jobdir = 'NC' + str(ncore) + 'HL'+list2str(nHL)+'E'+str(elimit)+'F'+str(flimit) 

    if jobdir in os.listdir(pwd):
        print(f"{jobdir} exists")
        if yes_or_no("continue ?"):
            pass
        else:
            sys.exit(1)
    else:
        com = f"will you make {jobdir}?"
        if yes_or_no(com):
            os.mkdir(jobdir)
            print(f"{jobdir} was made")
            new_dir = pwd + "/" + jobdir
            ### cd directory
            os.chdir(f"{new_dir}")
            for amp_dir in amp_db:
                os.system(f"ln -s {pwd}/{amp_dir} {new_dir}/{amp_dir}")
            #os.system(f"cp {pwd}/OUTCAR {new_dir}")
            print("amp- directories and OUTCAR were copied")
        else:
            print("exit")
            sys.exit(10)
        comm  = f"qsub -N {qjobname}"
        comm += f" -pe numa {ncore} -l mem={mem} -v fname={infile} -v pyjob={amp_job} -v hl=\"{str_hl}\" -v el={elimit} -v fl={flimit} -v nc={ncore}"
        comm += " -v ndata=" + ' '.join(ntotal)
        comm += f" -v dtype={ntype} "
        comm += " -v dlist='" + ' '.join(nlist) + "'"
        comm += " $SB/pypbs/sge_amp.csh"
        str1 = f"will you run: \n{comm}"
        if yes_or_no(str1):
            os.system(comm)
        ### Recover original directory
        os.chdir(f"{pwd}")
        return 0
Beispiel #2
0
def get_qname_app(queue_default, hlist):
    qname = queue_default+'HL'+list2str(hlist)
    return qname
Beispiel #3
0
def get_qname(queue_default, hlist):
    if queue_default == 'amp':
        qname = queue_default+'HL'+list2str(hlist)
    else:
        qname = queue_default
    return qname
Beispiel #4
0
def get_qname_suff(queue_default, *hlist):
    qname = queue_default + 'HL' + list2str(hlist)
    return qname