def _get_pool(): """ Creates one and only one pool using the configured settings """ global MYSQLPOOL if MYSQLPOOL is None: MYSQLPOOL = ManagerProxy(pool.manage(Database, **POOL_SETTINGS)) setattr(MYSQLPOOL, '_pid', os.getpid()) if getattr(MYSQLPOOL, '_pid', None) != os.getpid(): pool.clear_managers() return MYSQLPOOL
def get_pool(): """Create one and only one pool using the configured settings.""" global MYSQLPOOL if MYSQLPOOL is None: backend_name = getattr(settings, 'MYSQLPOOL_BACKEND', DEFAULT_BACKEND) backend = getattr(pool, backend_name) kwargs = getattr(settings, 'MYSQLPOOL_ARGUMENTS', {}) kwargs.setdefault('poolclass', backend) kwargs.setdefault('recycle', DEFAULT_POOL_TIMEOUT) MYSQLPOOL = pool.manage(OldDatabase, **kwargs) setattr(MYSQLPOOL, '_pid', os.getpid()) if getattr(MYSQLPOOL, '_pid', None) != os.getpid(): pool.clear_managers() return MYSQLPOOL
def get_pool(): "Creates one and only one pool using the configured settings." global MYSQLPOOL if MYSQLPOOL is None: backend = getattr(settings, 'MYSQLPOOL_BACKEND', MYSQLPOOL_BACKEND) backend = getattr(pool, backend) kwargs = getattr(settings, 'MYSQLPOOL_ARGUMENTS', {}) kwargs.setdefault('poolclass', backend) # The user can override this, but set it by default for safety. kwargs.setdefault('recycle', MYSQLPOOL_TIMEOUT) MYSQLPOOL = pool.manage(OldDatabase, **kwargs) setattr(MYSQLPOOL, '_pid', os.getpid()) if getattr(MYSQLPOOL, '_pid', None) != os.getpid(): pool.clear_managers() return MYSQLPOOL
def get_pool(): """Create one and only one pool using the configured settings.""" global MYSQLPOOL if MYSQLPOOL is None: backend_name = getattr(settings, "SHIELD_MYSQL_POOL_BACKEND", DEFAULT_BACKEND) backend = getattr(local_pool, backend_name) kwargs = getattr(settings, "SHIELD_MYSQL_POOL_ARGUMENTS", {}) kwargs.setdefault("poolclass", backend) kwargs.setdefault("recycle", DEFAULT_POOL_TIMEOUT) MYSQLPOOL = sa_pool.manage(OldDatabase, **kwargs) setattr(MYSQLPOOL, "_pid", os.getpid()) if getattr(MYSQLPOOL, "_pid", None) != os.getpid(): sa_pool.clear_managers() return MYSQLPOOL
def teardown_class(cls): pool.clear_managers()
def setup(self): pool.clear_managers() self._teardown_conns = []
def close_pool(): pool.clear_managers()
def setup(self): pool.clear_managers()
def tearDownAll(self): pool.clear_managers()
def tearDown(self): pool.clear_managers()