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

    The task implementation has been moved to :mod:`celery.app.task`.

    This contains the backward compatible Task class used in the old API,
    and shouldn't be used in new applications.

i    (   t   absolute_import(   t   Exchange(   t   current_app(   t   Contextt   TaskTypet   Task(   t   class_propertyt   reclassmethod(   t   maybe_schedule(   t   get_task_loggerR   t   PeriodicTaskt   taskt   delayt   apply_asynct   retryt   applyt   subtask_from_requestt   AsyncResultt   subtaskt   _get_requestt   _get_exec_optionsc           B@  s  e  Z d  Z e Z e Z e Z d Z	 d Z
 d Z d Z d Z e Z e Z d Z d Z e Z e Z e j d d f Z x* e D]" Z e e e e   e   e <qz We d    Z e d    Z e j d    Z e d	    Z  e d
    Z! d d d d  Z" e d d d   Z# RS(   sc   Deprecated Task base class.

    Modern applications should use :class:`celery.Task` instead.

    t   regulart   exchange_typet   CELERY_DEFAULT_EXCHANGE_TYPEt   delivery_modet   CELERY_DEFAULT_DELIVERY_MODEc         C@  s
   |  j    S(   N(   R   (   t   cls(    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyt   requestD   s    c         C@  s    |  j  d  k r |  j j S|  j  S(   N(   t   _backendt   Nonet   appt   backend(   R   (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyR   H   s    
c         C@  s   | |  _  d  S(   N(   R   (   R   t   value(    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyR   N   s    c         K@  s   t  |  j  S(   N(   R	   t   name(   t   selft   kwargs(    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyt
   get_loggerR   s    c         C@  s   |  j    j   S(   sΑ  Deprecated method used to get a broker connection.

        Should be replaced with :meth:`@Celery.connection`
        instead, or by acquiring connections from the connection pool:

        .. code-block:: python

            # using the connection pool
            with celery.pool.acquire(block=True) as conn:
                ...

            # establish fresh connection
            with celery.connection() as conn:
                ...
        (   t   _get_appt
   connection(   R"   (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyt   establish_connectionV   s    c         K@  s|   | d k r |  j n | } | d k r3 |  j } n  | pB |  j   } |  j   j j | d | ol t | |  d |  j | S(   sM  Deprecated method to get the task publisher (now called producer).

        Should be replaced with :class:`@amqp.TaskProducer`:

        .. code-block:: python

            with celery.connection() as conn:
                with celery.amqp.TaskProducer(conn) as prod:
                    my_task.apply_async(producer=prod)

        t   exchanget   routing_keyN(	   R   R(   R   R'   R%   t   amqpt   TaskProducerR   R)   (   R"   R&   R(   R   t   options(    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyt   get_publisheri   s    c         K@  se   |  j    j } | p |  j   } | d k rR |  j rF | j |  j n | j } n  | j | | |  S(   s’   Deprecated method used to get consumer for the queue
        this task is sent to.

        Should be replaced with :class:`@amqp.TaskConsumer` instead:

        N(   R%   R*   R'   R   t   queuet   queuest   default_queuet   TaskConsumer(   R"   R&   R/   R#   t   Q(    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyt   get_consumer   s
    %N(   R   R   (   R   R   ($   t   __name__t
   __module__t   __doc__t   Truet   abstractt   Falset	   __bound__t   __v2_compat__R   R.   R)   R(   R   R   t	   mandatoryt	   immediatet   priorityt   typet   disable_error_emailst   accept_magic_kwargst   BaseTaskt   from_configt   _COMPAT_CLASSMETHODSR!   R   t   getattrt   localsR   R   R   t   settert   classmethodR$   R'   R-   R3   (    (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyR      s:   
 c           B@  sD   e  Z d  Z e Z e Z e Z d Z	 e Z
 d   Z e d    Z RS(   s]   A periodic task is a task that adds itself to the
    :setting:`CELERYBEAT_SCHEDULE` setting.c         C@  sM   t  |  d  s t d   n  t |  j |  j  |  _ t t |   j   d  S(   Nt	   run_everys.   Periodic tasks must have a run_every attribute(   t   hasattrt   NotImplementedErrorR   RI   t   relativet   superR
   t   __init__(   R"   (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyRN      s
    c         C@  sS   i |  j  d 6|  j d 6d d 6i  d 6|  j p1 i  d 6|  j d 6| j j |  j  <d  S(   NR   t   schedulet   argsR#   R,   RL   (    (   R!   RI   R,   RL   t   conft   CELERYBEAT_SCHEDULE(   R   R   (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyt   on_bound   s    

N(   R4   R5   R6   R7   R8   t   ignore_resultR9   RL   R   R,   t   compatRN   RH   RS   (    (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyR
      s   	c          O@  s'   t  j |  t i t d 6t d 6|    S(   s5   Deprecated decorator, please use :func:`celery.task`.RA   t   base(   R   R   t   dictR9   R   (   RP   R#   (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyR   «   s    c          O@  s   t  t i t d 6|    S(   s@   Deprecated decorator, please use :setting:`CELERYBEAT_SCHEDULE`.RV   (   R   RW   R
   (   RP   R,   (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyt   periodic_task±   s    N(	   R   R   R   R   R   R   R   R   R   (   R6   t
   __future__R    t   kombuR   t   celeryR   t   celery.app.taskR   R   R   RB   t   celery.fiveR   R   t   celery.schedulesR   t   celery.utils.logR	   t   __all__RD   R
   R   RX   (    (    (    s2   /tmp/pip-unpacked-wheel-gV1wwp/celery/task/base.pyt   <module>   s    p	