Beispiel #1
0
def get_gse_data(gse, gpl, id_refs, attempt=0):
    ftp_con = manager.get_con()
    ftp = ftp_con.ftp
    problem = False
    data = {}
    try:
        ftp_downloader.get_gse_data_stream(ftp, gse, gpl,
                                           data_processor(data, id_refs))
    except ftplib.all_errors as e:
        print(e)
        problem = True
    except Exception as e:
        manager.release_con(ftp_con, problem)
        #this is a 400 error, the issue is with the user supplied resource info (or some edge case in NCBI, but let's pretend that won't happen)
        raise ValueError(e)
    manager.release_con(ftp_con, problem)
    #check if there was a problem and if need to retry with a new connection
    if problem:
        if attempt < RETRY:
            data = get_gse_data(gse, gpl, id_refs, attempt + 1)
        else:
            #this should be a 500 error
            raise RuntimeError(
                "A connection error has occured. Could not get FTP data")
    return data
Beispiel #2
0
 def get_data(ftp_con):
     return ftp_downloader.get_gse_data_stream(
         ftp_con, gse, gpl,
         self.stream_processor(table_start, table_end,
                               check_include_continue))