scripts/view/job_dequeuer.py
def lsf_script_generator(rfam_acc, uuid, out_dir):
    """
    Generates a shell script per family to ease re-running family view
    process upon failure

    rfam_acc: Family specific accession
    uuid: Family associated uuid
    out_dir: Path to output directory where scripts will be generated
    """

    mem = None

    if (rfam_acc in DEM_FAMS):
        mem = MEM_D
    else:
        mem = MEM_R

    # get where shell script will be generated
    filepath = os.path.join(os.path.join(out_dir, "scripts"), rfam_acc + ".sh")

    fp = open(filepath, 'w')

    filename = rfam_acc

    fv_cmd = "%s -id %s -f %s family" % (FAM_VIEW_PL, uuid, rfam_acc)

    fp.write("#!/bin/csh\n")

    #queue
    fp.write("#BSUB -q %s\n" % ("production-rh74"))
    # memory allocation
    fp.write("#BSUB -M %d\n" % (mem))
    fp.write("#BSUB -R \"rusage[mem=%d,tmp=%d]\"\n" % (mem, TMP_MEM))

    # pre-process
    fp.write("#BSUB -E \"mkdir -m 777 -p /tmp/%s\"\n" % (uuid))
    fp.write("#BSUB -cwd \"/tmp/%s\"\n" % (uuid))
    # generate error/output files
    fp.write("#BSUB -o \"/tmp/%s/%sJ.out\"\n" % (uuid, chr(PER_SYM_ASCII)))
    fp.write("#BSUB -e \"/tmp/%s/%sJ.err\"\n" % (uuid, chr(PER_SYM_ASCII)))

    # command for lsf to copy .out file to output directory
    fp.write("#BSUB -f \"%s/%s_%sJ.out < /tmp/%s/%sJ.out\"\n" %
             (os.path.abspath(out_dir), filename, chr(PER_SYM_ASCII), uuid, chr(PER_SYM_ASCII)))

    # command for lsf to copy .err file to output directory
    fp.write("#BSUB -f \"%s/%s_%sJ.err < /tmp/%s/%sJ.err\"\n" %
             (os.path.abspath(out_dir), filename, chr(PER_SYM_ASCII), uuid, chr(PER_SYM_ASCII)))

    # clean /tmp directory on execution host
    fp.write("#BSUB -Ep \"rm -rf /tmp/%s\"\n" % (uuid))

    # submit jobs under specified group
    fp.write("#BSUB -g \"%s\"\n\n" % (GROUP_NAME))

    # rfam_view command
    fp.write(fv_cmd)

    fp.write("\n\n")
    fp.close()

    # return file path to submit job to lsf
    return filepath

    Generates a shell script per family to ease re-running family view
    process upon failure

    rfam_acc: Family specific accession
    uuid: Family associated uuid
    out_dir: Path to output directory where scripts will be generated
    
Generates a shell script per family to ease re-running family view
process upon failure

Family specific accession
uuid: Family associated uuid
out_dir: Path to output directory where scripts will be generated
Generates a shell script per family to ease re - running family view process upon failure Family specific accession uuid : Family associated uuid out_dir : Path to output directory where scripts will be generated
def lsf_script_generator(rfam_acc, uuid, out_dir):
    mem = None
    if (rfam_acc in DEM_FAMS):
        mem = MEM_D
    else:
        mem = MEM_R
    filepath = os.path.join(os.path.join(out_dir, "scripts"), rfam_acc + ".sh")
    fp = open(filepath, 'w')
    filename = rfam_acc
    fv_cmd = "%s -id %s -f %s family" % (FAM_VIEW_PL, uuid, rfam_acc)
    fp.write("#!/bin/csh\n")
    fp.write("#BSUB -q %s\n" % ("production-rh74"))
    fp.write("#BSUB -M %d\n" % (mem))
    fp.write("#BSUB -R \"rusage[mem=%d,tmp=%d]\"\n" % (mem, TMP_MEM))
    fp.write("#BSUB -E \"mkdir -m 777 -p /tmp/%s\"\n" % (uuid))
    fp.write("#BSUB -cwd \"/tmp/%s\"\n" % (uuid))
    fp.write("#BSUB -o \"/tmp/%s/%sJ.out\"\n" % (uuid, chr(PER_SYM_ASCII)))
    fp.write("#BSUB -e \"/tmp/%s/%sJ.err\"\n" % (uuid, chr(PER_SYM_ASCII)))
    fp.write("#BSUB -f \"%s/%s_%sJ.out < /tmp/%s/%sJ.out\"\n" %
             (os.path.abspath(out_dir), filename, chr(PER_SYM_ASCII), uuid, chr(PER_SYM_ASCII)))
    fp.write("#BSUB -f \"%s/%s_%sJ.err < /tmp/%s/%sJ.err\"\n" %
             (os.path.abspath(out_dir), filename, chr(PER_SYM_ASCII), uuid, chr(PER_SYM_ASCII)))
    fp.write("#BSUB -Ep \"rm -rf /tmp/%s\"\n" % (uuid))
    fp.write("#BSUB -g \"%s\"\n\n" % (GROUP_NAME))
    fp.write(fv_cmd)
    fp.write("\n\n")
    fp.close()
    return filepath
def lsf_script_generator ( rfam_acc , uuid , out_dir ) : mem = None if ( rfam_acc in DEM_FAMS ) : mem = MEM_D else : mem = MEM_R filepath = os . path . join ( os . path . join ( out_dir , "scripts" ) , rfam_acc + ".sh" ) fp = open ( filepath , 'w' ) filename = rfam_acc fv_cmd = "%s -id %s -f %s family" % ( FAM_VIEW_PL , uuid , rfam_acc ) fp . write ( "#!/bin/csh\n" ) fp . write ( "#BSUB -q %s\n" % ( "production-rh74" ) ) fp . write ( "#BSUB -M %d\n" % ( mem ) ) fp . write ( "#BSUB -R \"rusage[mem=%d,tmp=%d]\"\n" % ( mem , TMP_MEM ) ) fp . write ( "#BSUB -E \"mkdir -m 777 -p /tmp/%s\"\n" % ( uuid ) ) fp . write ( "#BSUB -cwd \"/tmp/%s\"\n" % ( uuid ) ) fp . write ( "#BSUB -o \"/tmp/%s/%sJ.out\"\n" % ( uuid , chr ( PER_SYM_ASCII ) ) ) fp . write ( "#BSUB -e \"/tmp/%s/%sJ.err\"\n" % ( uuid , chr ( PER_SYM_ASCII ) ) ) fp . write ( "#BSUB -f \"%s/%s_%sJ.out < /tmp/%s/%sJ.out\"\n" % ( os . path . abspath ( out_dir ) , filename , chr ( PER_SYM_ASCII ) , uuid , chr ( PER_SYM_ASCII ) ) ) fp . write ( "#BSUB -f \"%s/%s_%sJ.err < /tmp/%s/%sJ.err\"\n" % ( os . path . abspath ( out_dir ) , filename , chr ( PER_SYM_ASCII ) , uuid , chr ( PER_SYM_ASCII ) ) ) fp . write ( "#BSUB -Ep \"rm -rf /tmp/%s\"\n" % ( uuid ) ) fp . write ( "#BSUB -g \"%s\"\n\n" % ( GROUP_NAME ) ) fp . write ( fv_cmd ) fp . write ( "\n\n" ) fp . close ( ) return filepath
Generates a shell script per family to ease re-running family view
process upon failure
Generates a shell script per family to ease re - running family view process upon failure
"""
    Generates a shell script per family to ease re-running family view
    process upon failure

    rfam_acc: Family specific accession
    uuid: Family associated uuid
    out_dir: Path to output directory where scripts will be generated
    """ # get where shell script will be generated #queue # memory allocation # pre-process # generate error/output files # command for lsf to copy .out file to output directory # command for lsf to copy .err file to output directory # clean /tmp directory on execution host # submit jobs under specified group # rfam_view command # return file path to submit job to lsf
rfam_acc
uuid
out_dir