Example #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),
         }
     )
Example #2
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),
     })
Example #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),
         }
     )
Example #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, ),
     })
Example #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, ),
     })
Example #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,
         ),
     })
Example #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)
Example #8
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 = (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()
Example #9
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._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)
Example #10
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.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)})
Example #11
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),
     })
Example #12
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),
     })
Example #13
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 = (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),
        })