예제 #1
0
 def _get_queue_arguments(self, ttl=None, expires=None):
     conf = self.app.conf
     return dictfilter(
         {
             "x-message-ttl": maybe_s_to_ms(ttl if ttl is not None else conf.event_queue_ttl),
             "x-expires": maybe_s_to_ms(expires if expires is not None else conf.event_queue_expires),
         }
     )
예제 #2
0
파일: __init__.py 프로젝트: xacce/celery
 def _get_queue_arguments(self):
     conf = self.app.conf
     return dictfilter({
         'x-message-ttl':
         maybe_s_to_ms(conf.CELERY_EVENT_QUEUE_TTL),
         'x-expires':
         maybe_s_to_ms(conf.CELERY_EVENT_QUEUE_EXPIRES),
     })
예제 #3
0
 def _get_queue_arguments(self):
     conf = self.app.conf
     return dictfilter(
         {
             "x-message-ttl": maybe_s_to_ms(conf.CELERY_EVENT_QUEUE_TTL),
             "x-expires": maybe_s_to_ms(conf.CELERY_EVENT_QUEUE_EXPIRES),
         }
     )
예제 #4
0
 def _get_queue_arguments(self, ttl=None, expires=None):
     conf = self.app.conf
     return dictfilter({
         'x-message-ttl':
         maybe_s_to_ms(ttl if ttl is not None else conf.event_queue_ttl, ),
         'x-expires':
         maybe_s_to_ms(
             expires
             if expires is not None else conf.event_queue_expires, ),
     })
예제 #5
0
 def _get_queue_arguments(self, ttl=None, expires=None):
     conf = self.app.conf
     return dictfilter({
         'x-message-ttl':
         maybe_s_to_ms(
             ttl if ttl is not None else conf.CELERY_EVENT_QUEUE_TTL, ),
         'x-expires':
         maybe_s_to_ms(
             expires
             if expires is not None else conf.CELERY_EVENT_QUEUE_EXPIRES, ),
     })
예제 #6
0
 def _get_queue_arguments(self, ttl=None, expires=None):
     conf = self.app.conf
     return dictfilter({
         'x-message-ttl': maybe_s_to_ms(
             ttl if ttl is not None else conf.CELERY_EVENT_QUEUE_TTL,
         ),
         'x-expires': maybe_s_to_ms(
             expires if expires is not None
             else conf.CELERY_EVENT_QUEUE_EXPIRES,
         ),
     })
예제 #7
0
 def __init__(self,
              app,
              connection=None,
              exchange=None,
              exchange_type=None,
              persistent=None,
              serializer=None,
              auto_delete=True,
              **kwargs):
     super(AMQPBackend, self).__init__(app, **kwargs)
     conf = self.app.conf
     self._connection = connection
     self.persistent = self.prepare_persistent(persistent)
     self.delivery_mode = 2 if self.persistent else 1
     exchange = exchange or conf.result_exchange
     exchange_type = exchange_type or conf.result_exchange_type
     self.exchange = self._create_exchange(
         exchange,
         exchange_type,
         self.delivery_mode,
     )
     self.serializer = serializer or conf.result_serializer
     self.auto_delete = auto_delete
     self.queue_arguments = dictfilter({
         'x-expires':
         maybe_s_to_ms(self.expires),
     })
     self.result_consumer = self.ResultConsumer(self, self.app, self.accept,
                                                self._pending_results)
     if register_after_fork is not None:
         register_after_fork(self, _on_after_fork_cleanup_backend)
예제 #8
0
파일: amqp.py 프로젝트: tsailiming/celery
    def __init__(self,
                 app,
                 connection=None,
                 exchange=None,
                 exchange_type=None,
                 persistent=None,
                 serializer=None,
                 auto_delete=True,
                 **kwargs):
        super(AMQPBackend, self).__init__(app, **kwargs)
        conf = self.app.conf
        self._connection = connection
        self.persistent = (conf.CELERY_RESULT_PERSISTENT
                           if persistent is None else persistent)
        exchange = exchange or conf.CELERY_RESULT_EXCHANGE
        exchange_type = exchange_type or conf.CELERY_RESULT_EXCHANGE_TYPE
        self.exchange = self._create_exchange(exchange, exchange_type,
                                              self.persistent)
        self.serializer = serializer or conf.CELERY_RESULT_SERIALIZER
        self.auto_delete = auto_delete

        self.expires = None
        if 'expires' not in kwargs or kwargs['expires'] is not None:
            self.expires = self.prepare_expires(kwargs.get('expires'))
        self.queue_arguments = dictfilter({
            'x-expires':
            maybe_s_to_ms(self.expires),
        })
        self.mutex = threading.Lock()
예제 #9
0
파일: amqp.py 프로젝트: lican09/celery
 def __init__(self, app, connection=None, exchange=None, exchange_type=None,
              persistent=None, serializer=None, auto_delete=True, **kwargs):
     super(AMQPBackend, self).__init__(app, **kwargs)
     conf = self.app.conf
     self._connection = connection
     self._out_of_band = {}
     self.persistent = self.prepare_persistent(persistent)
     self.delivery_mode = 2 if self.persistent else 1
     exchange = exchange or conf.result_exchange
     exchange_type = exchange_type or conf.result_exchange_type
     self.exchange = self._create_exchange(
         exchange, exchange_type, self.delivery_mode,
     )
     self.serializer = serializer or conf.result_serializer
     self.auto_delete = auto_delete
     self.queue_arguments = dictfilter({
         'x-expires': maybe_s_to_ms(self.expires),
     })
     self.result_consumer = self.ResultConsumer(
         self, self.app, self.accept,
         self._pending_results, self._weak_pending_results,
         self._pending_messages,
     )
     if register_after_fork is not None:
         register_after_fork(self, _on_after_fork_cleanup_backend)
예제 #10
0
파일: amqp.py 프로젝트: BillTheBest/celery
    def __init__(
        self,
        app,
        connection=None,
        exchange=None,
        exchange_type=None,
        persistent=None,
        serializer=None,
        auto_delete=True,
        **kwargs
    ):
        super(AMQPBackend, self).__init__(app, **kwargs)
        conf = self.app.conf
        self._connection = connection
        self.persistent = self.prepare_persistent(persistent)
        self.delivery_mode = 2 if self.persistent else 1
        exchange = exchange or conf.CELERY_RESULT_EXCHANGE
        exchange_type = exchange_type or conf.CELERY_RESULT_EXCHANGE_TYPE
        self.exchange = self._create_exchange(exchange, exchange_type, self.delivery_mode)
        self.serializer = serializer or conf.CELERY_RESULT_SERIALIZER
        self.auto_delete = auto_delete

        self.expires = None
        if "expires" not in kwargs or kwargs["expires"] is not None:
            self.expires = self.prepare_expires(kwargs.get("expires"))
        self.queue_arguments = dictfilter({"x-expires": maybe_s_to_ms(self.expires)})
예제 #11
0
파일: amqp.py 프로젝트: xmn1986/celery
 def __init__(self,
              app,
              connection=None,
              exchange=None,
              exchange_type=None,
              persistent=None,
              serializer=None,
              auto_delete=True,
              **kwargs):
     super(AMQPBackend, self).__init__(app, **kwargs)
     conf = self.app.conf
     self._connection = connection
     self.persistent = self.prepare_persistent(persistent)
     self.delivery_mode = 2 if self.persistent else 1
     exchange = exchange or conf.result_exchange
     exchange_type = exchange_type or conf.result_exchange_type
     self.exchange = self._create_exchange(
         exchange,
         exchange_type,
         self.delivery_mode,
     )
     self.serializer = serializer or conf.result_serializer
     self.auto_delete = auto_delete
     self.queue_arguments = dictfilter({
         'x-expires':
         maybe_s_to_ms(self.expires),
     })
예제 #12
0
파일: amqp.py 프로젝트: HideMode/celery
 def __init__(self, app, connection=None, exchange=None, exchange_type=None,
              persistent=None, serializer=None, auto_delete=True, **kwargs):
     super(AMQPBackend, self).__init__(app, **kwargs)
     conf = self.app.conf
     self._connection = connection
     self.persistent = self.prepare_persistent(persistent)
     self.delivery_mode = 2 if self.persistent else 1
     exchange = exchange or conf.result_exchange
     exchange_type = exchange_type or conf.result_exchange_type
     self.exchange = self._create_exchange(
         exchange, exchange_type, self.delivery_mode,
     )
     self.serializer = serializer or conf.result_serializer
     self.auto_delete = auto_delete
     self.queue_arguments = dictfilter({
         'x-expires': maybe_s_to_ms(self.expires),
     })
예제 #13
0
파일: amqp.py 프로젝트: EzyInsights/celery
    def __init__(self, app, connection=None, exchange=None, exchange_type=None,
                 persistent=None, serializer=None, auto_delete=True, **kwargs):
        super(AMQPBackend, self).__init__(app, **kwargs)
        conf = self.app.conf
        self._connection = connection
        self.persistent = (conf.CELERY_RESULT_PERSISTENT if persistent is None
                           else persistent)
        exchange = exchange or conf.CELERY_RESULT_EXCHANGE
        exchange_type = exchange_type or conf.CELERY_RESULT_EXCHANGE_TYPE
        self.exchange = self._create_exchange(exchange, exchange_type,
                                              self.persistent)
        self.serializer = serializer or conf.CELERY_RESULT_SERIALIZER
        self.auto_delete = auto_delete

        self.expires = None
        if 'expires' not in kwargs or kwargs['expires'] is not None:
            self.expires = self.prepare_expires(kwargs.get('expires'))
        self.queue_arguments = dictfilter({
            'x-expires': maybe_s_to_ms(self.expires),
        })