本文整理汇总了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'])
示例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')
示例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' )
示例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'] )