Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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
Beispiel #5
0
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 = []
Beispiel #8
0
def close_pool():
    pool.clear_managers()
Beispiel #9
0
 def setup(self):
     pool.clear_managers()
Beispiel #10
0
 def teardown_class(cls):
     pool.clear_managers()
Beispiel #11
0
 def setup(self):
     pool.clear_managers()
Beispiel #12
0
 def tearDownAll(self):
    pool.clear_managers()
Beispiel #13
0
 def tearDown(self):
    pool.clear_managers()
Beispiel #14
0
 def setup(self):
     pool.clear_managers()
     self._teardown_conns = []