utils/db_utils.py
def update_post_process(jobs_file):
    """
    Updates _post_process table with the job_ids per family assigned by lsf

    jobs_file: This is a tab separated txt file generated from running the
    job_dequeuer.py script that submits the rfam_view_process for each
    family.
    (rfam_acc uuid job_id ...)
    """

    job_ids = []

    jobs_file_fp = open(jobs_file, 'r')

    query = ("UPDATE _post_process SET lsf_id=%s "
       "WHERE rfam_acc=%s AND uuid=%s")

    # get lsf ids from file
    for line in jobs_file_fp:
      line = line.strip()
      line = string.split(line, '\t')
      job_ids.append((line[2], line[0], line[1]))

      jobs_file_fp.close()

    # connect to db
    cnx = RfamDB.connect()
    cursor = cnx.cursor(raw=True)

    # update db
    try:
        cursor.executemany(query, job_ids)
        cnx.commit()  # move this after except statement??

    except:
        # rollback to previous state
        print ("MySQL Update Error. Rollback...")
        cnx.rollback()
        cursor.close()
        RfamDB.disconnect(cnx)

    cursor.close()
    RfamDB.disconnect(cnx)

    Updates _post_process table with the job_ids per family assigned by lsf

    jobs_file: This is a tab separated txt file generated from running the
    job_dequeuer.py script that submits the rfam_view_process for each
    family.
    (rfam_acc uuid job_id ...)
    
Updates _post_process table with the job_ids per family assigned by lsf
jobs_file: This is a tab separated txt file generated from running the
job_dequeuer.py script that submits the rfam_view_process for each
family.
Updates _post_process table with the job_ids per family assigned by lsf jobs_file : This is a tab separated txt file generated from running the job_dequeuer . py script that submits the rfam_view_process for each family .
def update_post_process(jobs_file):
    job_ids = []
    jobs_file_fp = open(jobs_file, 'r')
    query = ("UPDATE _post_process SET lsf_id=%s "
       "WHERE rfam_acc=%s AND uuid=%s")
    for line in jobs_file_fp:
      line = line.strip()
      line = string.split(line, '\t')
      job_ids.append((line[2], line[0], line[1]))
      jobs_file_fp.close()
    cnx = RfamDB.connect()
    cursor = cnx.cursor(raw=True)
    try:
        cursor.executemany(query, job_ids)
        cnx.commit()  
    except:
        print ("MySQL Update Error. Rollback...")
        cnx.rollback()
        cursor.close()
        RfamDB.disconnect(cnx)
    cursor.close()
    RfamDB.disconnect(cnx)
def update_post_process ( jobs_file ) : job_ids = [ ] jobs_file_fp = open ( jobs_file , 'r' ) query = ( "UPDATE _post_process SET lsf_id=%s " "WHERE rfam_acc=%s AND uuid=%s" ) for line in jobs_file_fp : line = line . strip ( ) line = string . split ( line , '\t' ) job_ids . append ( ( line [ 2 ] , line [ 0 ] , line [ 1 ] ) ) jobs_file_fp . close ( ) cnx = RfamDB . connect ( ) cursor = cnx . cursor ( raw = True ) try : cursor . executemany ( query , job_ids ) cnx . commit ( ) except : print ( "MySQL Update Error. Rollback..." ) cnx . rollback ( ) cursor . close ( ) RfamDB . disconnect ( cnx ) cursor . close ( ) RfamDB . disconnect ( cnx )
Updates _post_process table with the job_ids per family assigned by lsf
jobs_file: This is a tab separated txt file generated from running the
job_dequeuer.py script that submits the rfam_view_process for each
family.
Updates _post_process table with the job_ids per family assigned by lsf jobs_file : This is a tab separated txt file generated from running the job_dequeuer . py script that submits the rfam_view_process for each family .
"""
    Updates _post_process table with the job_ids per family assigned by lsf

    jobs_file: This is a tab separated txt file generated from running the
    job_dequeuer.py script that submits the rfam_view_process for each
    family.
    (rfam_acc uuid job_id ...)
    """ # get lsf ids from file # connect to db # update db # move this after except statement?? # rollback to previous state
jobs_file