Esempio n. 1
0
 def __init__(self, *args, **kwargs):
     deprecated.warn(
         'The AMQP backend',
         deprecation='4.0',
         removal='5.0',
         alternative='Please use RPC backend or a persistent backend.')
     super(AMQPBackend, self).__init__(*args, **kwargs)
Esempio n. 2
0
 def __init__(self,
              app,
              connection=None,
              exchange=None,
              exchange_type=None,
              persistent=None,
              serializer=None,
              auto_delete=True,
              **kwargs):
     deprecated.warn(
         'The AMQP result backend',
         deprecation='4.0',
         removal='5.0',
         alternative='Please use RPC backend or a persistent backend.')
     super().__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
Esempio n. 3
0
def find_deprecated_settings(source):  # pragma: no cover
    from celery.utils import deprecated
    for name, opt in flatten(NAMESPACES):
        if (opt.deprecate_by or opt.remove_by) and getattr(source, name, None):
            deprecated.warn(description='The {0!r} setting'.format(name),
                            deprecation=opt.deprecate_by,
                            removal=opt.remove_by,
                            alternative='Use the {0.alt} instead'.format(opt))
    return source
Esempio n. 4
0
def find_deprecated_settings(source):  # pragma: no cover
    from celery.utils import deprecated
    for name, opt in flatten(NAMESPACES):
        if (opt.deprecate_by or opt.remove_by) and getattr(source, name, None):
            deprecated.warn(description='The {0!r} setting'.format(name),
                            deprecation=opt.deprecate_by,
                            removal=opt.remove_by,
                            alternative='Use the {0.alt} instead'.format(opt))
    return source
Esempio n. 5
0
    def maybe_warn_deprecated_settings(self):
        # TODO: Remove this method in Celery 6.0
        if self.deprecated_settings:
            from celery.app.defaults import _TO_NEW_KEY
            from celery.utils import deprecated
            for setting in self.deprecated_settings:
                deprecated.warn(description=f'The {setting!r} setting',
                                removal='6.0.0',
                                alternative=f'Use the {_TO_NEW_KEY[setting]} instead')

            return True

        return False
Esempio n. 6
0
 def __init__(self, app, connection=None, exchange=None, exchange_type=None,
              persistent=None, serializer=None, auto_delete=True, **kwargs):
     deprecated.warn(
         'The AMQP result backend', deprecation='4.0', removal='5.0',
         alternative='Please use RPC backend or a persistent backend.')
     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
Esempio n. 7
0
 def __init__(self, *args, **kwargs):
     deprecated.warn(
         'The AMQP backend', deprecation='4.0', removal='5.0',
         alternative='Please use RPC backend or a persistent backend.')
     super(AMQPBackend, self).__init__(*args, **kwargs)
 def test_warn_deprecated(self, warn):
     deprecated.warn('Foo')
     warn.assert_called()
Esempio n. 9
0
 def test_warn_deprecated(self, warn):
     deprecated.warn('Foo')
     warn.assert_called()