ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ 4]c@sdZddlZddlZddlmZddlmZddlmZddlmZdd lm Z dd l m Z dd l m Z dd l m Z d efdYZdefdYZdefdYZdefdYZdefdYZdS(sPool implementation classes. iNi(t_ConnectionFairy(t_ConnectionRecord(tPooli(texc(tutil(tchop_traceback(tqueue(t threadingt QueuePoolcBseZdZdddedZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZRS(sA :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|tWn0tjk rIz|jWd|jXnXdS(N(R tputtFalseR tFulltcloset _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||jSWntjk rWnX|r|j|jkr|s|jStj d|j |j |jfddn|j ry|j SWqtj|jWdQXqXn |jSdS(NisPQueuePool limit of size %d overflow %d reached, connection timed out, timeout %dtcodet3o7r(RRR tgetRR tEmptyt_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(Nii(RRtTrueRR(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyR(s cCsI|jdkr"|jd8_tS|j|jd8_tSWdQXdS(Nii(RRR-R(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRs  cCs}|jjd|j|jd|jjd|jd|jd|jd|j d|j d|j d |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.pytrecreates          cCsuxBtrDy |jjt}|jWqtjk r@PqXqWd|j|_|j j d|j dS(NisPool disposed. %s( R-R R"RRR R#R&RR5R6tstatus(RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pytdisposes  cCs,d|j|j|j|jfS(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.pyRAs    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.pyRscCs |jjS(N(R tqsize(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRCscCs|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.pyRDs(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;eZdZdZdZdZdZdZRS(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.pyRAscCs|jdS(N(R(RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRscCs |jS(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.pyRBs(RFRGRHRARR$R@RB(((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRIs      tSingletonThreadPoolcBsbeZdZddZdZdZdZdZdZdZ d Z d Z RS( sA 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|jWq tk r1q Xq W|jjdS(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}|jqWdS(N(tlenROR&tpopR(Rtc((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyt_cleanupCscCsdt|t|jfS(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.pyRNscCsy|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=|jStj||jS(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 StaticPoolcBsheZdZejdZejdZdZdZdZ dZ dZ dZ 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 |jS(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 connectionscCsdS(NRc((R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRAscCs,d|jkr(|jjd|_ndS(NRL(t__dict__RLRR\(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRBs 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.pyRscCs|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 AssertionPoolcBsDeZdZdZdZdZdZdZdZRS(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.pyRAscCs:|jstdnt|_||jks6tdS(Nsconnection is not checked out(RitAssertionErrorRRL(RR((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRs  cCs&t|_|jr"|jjndS(N(RRiRLR(R((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyRBs  c CsD|jjd|j|jd|jd|jd|jd|jS(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|_|jrt 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.pyRgs      (RHRpRYtbaseRRRRnRRRRR RRRIRJRcRg(((sG/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/impl.pyt s  (q2