Exemple #1
0
 def __init__(self):
     database_config = DATABASE.copy()
     db_name = database_config.pop("name")
     if WORK_MODE == WorkMode.STANDALONE:
         self.database_connection = APSWDatabase('fate_flow_sqlite.db')
         RuntimeConfig.init_config(USE_LOCAL_DATABASE=True)
         stat_logger.info('init sqlite database on standalone mode successfully')
     elif WORK_MODE == WorkMode.CLUSTER:
         self.database_connection = PooledMySQLDatabase(db_name, **database_config)
         stat_logger.info('init mysql database on cluster mode successfully')
         RuntimeConfig.init_config(USE_LOCAL_DATABASE=False)
     else:
         raise Exception('can not init database')
Exemple #2
0
 def __init__(self):
     database_config = DATABASE.copy()
     db_name = database_config.pop("name")
     if IS_STANDALONE:
         from playhouse.apsw_ext import APSWDatabase
         self.database_connection = APSWDatabase(
             file_utils.get_project_base_directory("fate_sqlite.db"))
         RuntimeConfig.init_config(USE_LOCAL_DATABASE=True)
         stat_logger.info(
             'init sqlite database on standalone mode successfully')
     else:
         self.database_connection = PooledMySQLDatabase(
             db_name, **database_config)
         stat_logger.info(
             'init mysql database on cluster mode successfully')