本文整理汇总了Python中sqlalchemy.pool.clear_managers函数的典型用法代码示例。如果您正苦于以下问题:Python clear_managers函数的具体用法?Python clear_managers怎么用?Python clear_managers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clear_managers函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_pool
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
示例2: get_pool
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
示例3: get_pool
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
示例4: close_pool
def close_pool():
pool.clear_managers()
示例5: teardown_class
def teardown_class(cls):
pool.clear_managers()
示例6: setup
def setup(self):
pool.clear_managers()
示例7: tearDownAll
def tearDownAll(self):
pool.clear_managers()
示例8: setup
def setup(self):
pool.clear_managers()
self._teardown_conns = []