σ
P'^c        	   @@  s  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l m Z d d l m	 Z	 d d l
 m Z d d l m Z m Z d d l m Z m Z d d	 l m Z d d
 l m Z d d l m Z d d g Z e d  Z d i  d d d e j d e d  Z d e f d     YZ d S(   sS   
    celery.concurrency.base
    ~~~~~~~~~~~~~~~~~~~~~~~

    TaskPool interface.

i    (   t   absolute_importN(   t   ExceptionInfo(   t   WorkerLostError(   t	   safe_repr(   t   WorkerShutdownt   WorkerTerminate(   t	   monotonict   reraise(   t   timer2(   t   truncate(   t
   get_loggert   BasePoolt   apply_targets   celery.poolc	         K@  sγ   | r" | | p |   |    n  y |  | |   }
 Wn | k
 rK   n t  k
 r^   n t t f k
 rw   nh t k
 rΤ } y* t t t t |   t j   d  Wqί t k
 rΠ | t	    qί Xn X| |
  d  S(   Ni   (
   t	   ExceptionR   R   t   BaseExceptionR   R   t   reprt   syst   exc_infoR   (   t   targett   argst   kwargst   callbackt   accept_callbackt   pidt   getpidt	   propagateR   t   _t   rett   exc(    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyR      s"    c           B@  s=  e  Z d  Z d Z d Z e j Z e Z e	 Z
 d Z d Z e	 Z e Z d e e d d  Z d   Z d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z  d   Z! g  i  d  Z" d   Z# e$ d    Z% e$ d    Z& e$ d    Z' RS(   i   i   i   c         K@  sF   | |  _  | |  _ | |  _ | |  _ | |  _ t j t j  |  _	 d  S(   N(
   t   limitt   putlockst   optionst   forking_enablet   callbacks_propagatet   loggert   isEnabledFort   loggingt   DEBUGt   _does_debug(   t   selfR   R   R    R!   R   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   __init__K   s    					c         C@  s   d  S(   N(    (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   on_startT   s    c         C@  s   t  S(   N(   t   True(   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   did_start_okW   s    c         C@  s   d  S(   N(    (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   flushZ   s    c         C@  s   d  S(   N(    (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   on_stop]   s    c         C@  s   d  S(   N(    (   R'   t   loop(    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   register_with_event_loop`   s    c         O@  s   d  S(   N(    (   R'   R   R   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   on_applyc   s    c         C@  s   d  S(   N(    (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   on_terminatef   s    c         C@  s   d  S(   N(    (   R'   t   job(    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   on_soft_timeouti   s    c         C@  s   d  S(   N(    (   R'   R2   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   on_hard_timeoutl   s    c         O@  s   d  S(   N(    (   R'   R   R   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   maintain_poolo   s    c         C@  s   t  d j t |      d  S(   Ns   {0} does not implement kill_job(   t   NotImplementedErrort   formatt   type(   R'   R   t   signal(    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   terminate_jobr   s    c         C@  s   t  d j t |      d  S(   Ns   {0} does not implement restart(   R6   R7   R8   (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   restartv   s    c         C@  s   |  j    |  j |  _ d  S(   N(   R-   t	   TERMINATEt   _state(   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   stopz   s    
c         C@  s   |  j  |  _ |  j   d  S(   N(   R<   R=   R1   (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt	   terminate~   s    c         C@  s   |  j    |  j |  _ d  S(   N(   R)   t   RUNR=   (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   start   s    
c         C@  s   |  j  |  _ |  j   d  S(   N(   t   CLOSER=   t   on_close(   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   close   s    c         C@  s   d  S(   N(    (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyRC      s    c      	   K@  sh   |  j  r@ t j d | t t |  d  t t |  d   n  |  j | | | d |  j d |  j | S(   sΙ   Equivalent of the :func:`apply` built-in function.

        Callbacks should optimally return as soon as possible since
        otherwise the thread which handles the result will get blocked.

        s&   TaskPool: Apply %s (args:%s kwargs:%s)i   t   waitforslotR!   (   R&   R"   t   debugR	   R   R0   R   R!   (   R'   R   R   R   R   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   apply_async   s    			c         C@  s   i  S(   N(    (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt	   _get_info   s    c         C@  s
   |  j    S(   N(   RH   (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   info‘   s    c         C@  s   |  j  |  j k S(   N(   R=   R@   (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   active₯   s    c         C@  s   |  j  S(   N(   R   (   R'   (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   num_processes©   s    N(    ((   t   __name__t
   __module__R@   RB   R<   R   t   TimerR*   t   signal_safet   Falset   is_greent   NoneR=   t   _poolt   uses_semaphoret   task_join_will_blockR(   R)   R+   R,   R-   R/   R0   R1   R3   R4   R5   R:   R;   R>   R?   RA   RD   RC   RG   RH   t   propertyRI   RJ   RK   (    (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyR   5   sD   																		(    (    (   t   __doc__t
   __future__R    R$   t   osR   t   billiard.einfoR   t   billiard.exceptionsR   t   kombu.utils.encodingR   t   celery.exceptionsR   R   t   celery.fiveR   R   t   celery.utilsR   t   celery.utils.textR	   t   celery.utils.logR
   t   __all__R"   RR   R   R   t   objectR   (    (    (    s9   /tmp/pip-unpacked-wheel-gV1wwp/celery/concurrency/base.pyt   <module>   s$   	