当前位置: 首页>>代码示例>>Python>>正文


Python Settings.init_logger方法代码示例

本文整理汇总了Python中settings.Settings.init_logger方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.init_logger方法的具体用法?Python Settings.init_logger怎么用?Python Settings.init_logger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在settings.Settings的用法示例。


在下文中一共展示了Settings.init_logger方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import init_logger [as 别名]
 def setUp(self):
     self.genome_db = genome_database.GenomeDB()
     s = Settings.get_settings('../config/cge-dev.cfg')
     logger = Settings.init_logger(s)
     
     conn = MySQLdb.connect( **s['mysql_genome_sync'] )
     curs = conn.cursor()
     curs.execute('TRUNCATE genome')
     curs.execute('TRUNCATE bioproject')
     curs.close()
     conn.close()
     
     self.genome_db.connect(**s['mysql_genome_sync'])
开发者ID:GingerbreadNinja,项目名称:CBS_Genome_Atlas,代码行数:15,代码来源:test_genome_database.py

示例2: update_taxonomy

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import init_logger [as 别名]
def update_taxonomy():
    s = Settings.get_settings('../config/cge-dev.cfg')
    logger = Settings.init_logger(s)
    logger.info('Beginning taxonomy lookup')
    
    conn = MySQLdb.connect( **s['mysql_genome_sync'] )
    curs = conn.cursor()
    statement = """SELECT bioproject_id FROM genome WHERE tax_id IS NULL"""
    res = curs.execute(statement)
    id_list = curs.fetchall()
    logger.info('Found %i taxonomies to lookup', len( id_list ))
    #id_list = id_list[1:50] #test
    id_tax = lookup_taxonomy(logger, id_list, s['entrez']['email'])
    logger.info('Looked up %i taxonomies', len( id_tax ))
    update_statement = """UPDATE genome SET tax_id = %s WHERE bioproject_id = %s"""
    tax_id = [(tax, id) for id, tax in id_tax]
    res = curs.executemany(update_statement, tax_id)
    conn.commit()
    logger.info('Finished updating taxonomies')
开发者ID:GingerbreadNinja,项目名称:CBS_Genome_Atlas,代码行数:21,代码来源:update_taxonomy.py

示例3: syncronize

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import init_logger [as 别名]
def syncronize():
    parser = argparse.ArgumentParser(description="Synchronize NCBI Genomes with Database")
    parser.add_argument('-c', '--config',help='Use the specified settings file', default='../config/cge-dev.cfg')
    args = parser.parse_args()
    
    s = Settings.get_settings( args.config )
    logger = Settings.init_logger(s)
    logger.info('Beginning Genome Sync')
    
    ftp_settings = s['ftp_ncbi']
    
    old_filename = ftp_settings['saveas'] + '.old'
    if( os.path.exists( ftp_settings['saveas'] ) ):
        os.rename( ftp_settings['saveas'], old_filename )

    ftp = FTP_Get(logger.getChild('NCBI-FTP'))
    ftp.connect(host=ftp_settings['host'],
                user=ftp_settings['user'],
                passwd=ftp_settings['passwd'],
                acct=ftp_settings['acct'],
                timeout=ftp_settings['timeout'])
    
    csv_file = None            
    if(ftp_settings.get('dirname',None)):
        ftp.cwd( ftp_settings['dirname'] )
    try:
        csv_file = ftp.getFile( ftp_settings['filename'], ftp_settings['saveas'])
        ftp.close()
        
    except Exception, e:
        if( csv_file ):
            csv_file.close()
        if( os.path.exists( ftp_settings['saveas'] ) ):
            os.remove( ftp_settings['saveas'] )
        logger.error('Error durring FTP download of %s' % ftp_settings['filename'])
        logger.debug( e.message )
        logger.info( 'Using Old FTP File instead' )
        if( os.path.exists( old_filename )):
            csv_file = open( old_filename, 'rb' )
开发者ID:GingerbreadNinja,项目名称:CBS_Genome_Atlas,代码行数:41,代码来源:genomesync.py

示例4: setUp

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import init_logger [as 别名]
 def setUp(self):
     s = Settings.get_settings('../config/cge-dev.cfg')
     logger = Settings.init_logger(s)
     self.__gbk_mysql = replicon_database.RepliconDB(logger.getChild('TestRepliconDB'))
     self.__gbk_mysql.connect( **s['mysql_replicon'] )
开发者ID:GingerbreadNinja,项目名称:CBS_Genome_Atlas,代码行数:7,代码来源:test_replicon_database.py


注:本文中的settings.Settings.init_logger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。