%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyc

�
��4]c@sdZddlZddlZddlmZddlmZddlmZddlmZdd	lm	Z	dd
l	m
Z
ddl	mZddl	m
Z
d
efd��YZdefd��YZdefd��YZdefd��YZdefd��YZdS(sPool implementation classes.

i����Ni(t_ConnectionFairy(t_ConnectionRecord(tPooli(texc(tutil(tchop_traceback(tqueue(t	threadingt	QueuePoolcBs�eZdZddded�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
d�Zd�Zd�ZRS(s�A :class:`.Pool` that imposes a limit on the number of open connections.

    :class:`.QueuePool` is the default pooling implementation used for
    all :class:`.Engine` objects, unless the SQLite dialect is in use.

    ii
icKs]tj|||�tj|d|�|_d||_||_||_tj	�|_
dS(s$	
        Construct a QueuePool.

        :param creator: a callable function that returns a DB-API
          connection object, same as that of :paramref:`.Pool.creator`.

        :param pool_size: The size of the pool to be maintained,
          defaults to 5. This is the largest number of connections that
          will be kept persistently in the pool. Note that the pool
          begins with no connections; once this number of connections
          is requested, that number of connections will remain.
          ``pool_size`` can be set to 0 to indicate no size limit; to
          disable pooling, use a :class:`~sqlalchemy.pool.NullPool`
          instead.

        :param max_overflow: The maximum overflow size of the
          pool. When the number of checked-out connections reaches the
          size set in pool_size, additional connections will be
          returned up to this limit. When those additional connections
          are returned to the pool, they are disconnected and
          discarded. It follows then that the total number of
          simultaneous connections the pool will allow is pool_size +
          `max_overflow`, and the total number of "sleeping"
          connections the pool will allow is pool_size. `max_overflow`
          can be set to -1 to indicate no overflow limit; no limit
          will be placed on the total number of concurrent
          connections. Defaults to 10.

        :param timeout: The number of seconds to wait before giving up
          on returning a connection. Defaults to 30.

        :param use_lifo: use LIFO (last-in-first-out) when retrieving
          connections instead of FIFO (first-in-first-out). Using LIFO, a
          server-side timeout scheme can reduce the number of connections used
          during non-peak periods of use.   When planning for server-side
          timeouts, ensure that a recycle or pre-ping strategy is in use to
          gracefully handle stale connections.

          .. versionadded:: 1.3

          .. seealso::

            :ref:`pool_use_lifo`

            :ref:`pool_disconnects`

        :param \**kw: Other keyword arguments including
          :paramref:`.Pool.recycle`, :paramref:`.Pool.echo`,
          :paramref:`.Pool.reset_on_return` and others are passed to the
          :class:`.Pool` constructor.

        tuse_lifoiN(Rt__init__t
sqla_queuetQueuet_poolt	_overflowt
_max_overflowt_timeoutRtLockt_overflow_lock(tselftcreatort	pool_sizetmax_overflowttimeoutR	tkw((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR
#s=
		cCsNy|jj|t�Wn0tjk
rIz|j�Wd|j�XnXdS(N(R
tputtFalseRtFulltcloset
_dec_overflow(Rtconn((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyt_do_return_conngscCs|jdk}y2|o'|j|jk}|jj||j�SWntjk
rWnX|r�|j|jkr�|s�|j�Stj	d|j
�|j�|jfdd��n|j�r�y|j
�SWqtj��|j�WdQXqXn
|j�SdS(Ni����sPQueuePool limit of size %d overflow %d reached, connection timed out, timeout %dtcodet3o7r(RRR
tgetRRtEmptyt_do_getRtTimeoutErrortsizetoverflowt
_inc_overflowt_create_connectionRtsafe_reraiseR(Rtuse_overflowtwait((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR$ps(

cCs_|jdkr"|jd7_tS|j�.|j|jkrQ|jd7_tStSWdQXdS(Ni����i(RRtTrueRR(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR(�s
cCsI|jdkr"|jd8_tS|j�|jd8_tSWdQXdS(Ni����i(RRR-R(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR�s
cCs}|jjd�|j|jd|jjd|jd|jd|jd|j	d|j
d|jd	|jd
|j
d|j�
S(NsPool recreatingRRRtrecycletechotlogging_nametuse_threadlocaltreset_on_returnt	_dispatchtdialect(tloggertinfot	__class__t_creatorR
tmaxsizeRRt_recycleR/t_orig_logging_namet_use_threadlocalt_reset_on_returntdispatcht_dialect(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pytrecreate�s									cCsuxBtrDy |jjt�}|j�Wqtjk
r@PqXqWd|j�|_|j	j
d|j��dS(NisPool disposed. %s(R-R
R"RRRR#R&RR5R6tstatus(RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pytdispose�s		cCs,d|j�|j�|j�|j�fS(Ns_Pool size: %d  Connections in pool: %d Current Overflow: %d Current Checked out connections: %d(R&t	checkedinR't
checkedout(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRA�s
			cCs
|jjS(N(R
R9(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR&�scCs|jS(N(R(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR�scCs
|jj�S(N(R
tqsize(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRC�scCs|jS(N(R(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR'�scCs|jj|jj�|jS(N(R
R9RER(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRD�s(t__name__t
__module__t__doc__RR
RR$R(RR@RBRAR&RRCR'RD(((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRs">								
				tNullPoolcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(sQA Pool which does not pool connections.

    Instead it literally opens and closes the underlying DB-API connection
    per each connection open/close.

    Reconnect-related functions such as ``recycle`` and connection
    invalidation are not supported by this Pool implementation, since
    no connections are held persistently.

    cCsdS(NRI((R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRA�scCs|j�dS(N(R(RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR�scCs
|j�S(N(R)(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR$�scCs_|jjd�|j|jd|jd|jd|jd|jd|jd|j	d|j
�S(	NsPool recreatingR.R/R0R1R2R3R4(R5R6R7R8R:R/R;R<R=R>R?(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR@�s							cCsdS(N((R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRB�s(RFRGRHRARR$R@RB(((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRI�s				tSingletonThreadPoolcBsbeZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�ZRS(s�A Pool that maintains one connection per thread.

    Maintains one connection per each thread, never moving a connection to a
    thread other than the one which it was created in.

    .. warning::  the :class:`.SingletonThreadPool` will call ``.close()``
       on arbitrary connections that exist beyond the size setting of
       ``pool_size``, e.g. if more unique **thread identities**
       than what ``pool_size`` states are used.   This cleanup is
       non-deterministic and not sensitive to whether or not the connections
       linked to those thread identities are currently in use.

       :class:`.SingletonThreadPool` may be improved in a future release,
       however in its current status it is generally used only for test
       scenarios using a SQLite ``:memory:`` database and is not recommended
       for production use.


    Options are the same as those of :class:`.Pool`, as well as:

    :param pool_size: The number of threads in which to maintain connections
        at once.  Defaults to five.

    :class:`.SingletonThreadPool` is used by the SQLite dialect
    automatically when a memory-based database is used.
    See :ref:`sqlite_toplevel`.

    icKsJtj|||�tj�|_tj�|_t�|_||_dS(N(	RR
Rtlocalt_connt_fairytsett
_all_connsR&(RRRR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR
!s
cCsh|jjd�|j|jd|jd|jd|jd|jd|jd|j	d|j
d	|j�S(
NsPool recreatingRR.R/R0R1R2R3R4(R5R6R7R8R&R:R/R;R<R=R>R?(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR@(s								cCsGx3|jD](}y|j�Wq
tk
r1q
Xq
W|jj�dS(sDispose of this pool.N(RORt	Exceptiontclear(RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRB6s
cCs<x5t|j�|jkr7|jj�}|j�qWdS(N(tlenROR&tpopR(Rtc((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyt_cleanupCscCsdt|�t|j�fS(Ns"SingletonThreadPool id:%d size: %d(tidRRRO(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRAHs	cCsdS(N((RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRNscCs�y|jj�}|r|SWntk
r0nX|j�}tj|�|j_t|j�|jkrw|j	�n|jj
|�|S(N(RLtcurrenttAttributeErrorR)tweakreftrefRRROR&RUtadd(RRT((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR$Qs

cCsPy|jj�}Wntk
r&nX|dk	r=|j�Stj||j�S(N(RMRWRXtNonet_checkout_existingRt	_checkout(Rtrec((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pytconnect_s

cCs2y
|j`Wntk
r nX|j|�dS(N(RMRWRXR(Rtrecord((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyt_return_connks


(RFRGRHR
R@RBRURARR$R`Rb(((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRJs		
					t
StaticPoolcBsheZdZejd��Zejd��Zd�Zd�Zd�Z	d�Z
d�Zd�ZRS(	s.A Pool of exactly one connection, used for all requests.

    Reconnect-related functions such as ``recycle`` and connection
    invalidation (which is also used to support auto-reconnect) are not
    currently supported by this Pool implementation but may be implemented
    in a future release.

    cCs
|j�S(N(R8(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRL~scCs
t|�S(N(R(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyt
connection�scCsdS(NRc((R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRA�scCs,d|jkr(|jj�d|_ndS(NRL(t__dict__RLRR\(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRB�s
cCsb|jjd�|jd|jd|jd|jd|jd|jd|jd|j	d	|j
�S(
NsPool recreatingRR.R1R2R/R0R3R4(R5R6R7R8R:R<R=R/R;R>R?(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR@�s								cCs|jS(N(RL(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR)�scCsdS(N((RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR�scCs|jS(N(Rd(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR$�s(
RFRGRHRtmemoized_propertyRLRdRARBR@R)RR$(((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRcss				
		t
AssertionPoolcBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sA :class:`.Pool` that allows at most one checked out connection at
    any given time.

    This will raise an exception if more than one connection is checked out
    at a time.  Useful for debugging code that is using more connections
    than desired.

    cOsGd|_t|_|jdt�|_d|_tj	|||�dS(Ntstore_traceback(
R\RLRt_checked_outRSR-t_store_tracebackt_checkout_tracebackRR
(RtargsR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR
�s
			cCsdS(NRg((R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRA�scCs:|jstd��nt|_||jks6t�dS(Nsconnection is not checked out(RitAssertionErrorRRL(RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR�s		cCs&t|_|jr"|jj�ndS(N(RRiRLR(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRB�s		c
CsD|jjd�|j|jd|jd|jd|jd|j�S(NsPool recreatingR/R0R3R4(R5R6R7R8R/R;R>R?(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR@�s				cCs�|jrJ|jr1ddjt|j��}nd}td|��n|jse|j�|_nt|_|jr�t	j
�|_n|jS(Ns at:
%sts!connection is already checked out(RiRktjoinRRmRLR)R-Rjt	tracebacktformat_stack(Rtsuffix((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR$�s						(	RFRGRHR
RARRBR@R$(((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRg�s						
(RHRpRYtbaseRRRRnRRRRRRRRIRJRcRg(((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyt<module>s�(q2

Zerion Mini Shell 1.0