Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cached_property
def router(self):
return self.Router()
@cached_property
def db(self):
self._is_open = True
return self.open()
@cached_property
def client(self):
"""Client used to publish messages, BRPOP etc."""
return self._create_client()
@cached_property
def queue_cls(self):
return self._declarative_cls(
bytes_if_py2('Queue'),
QueueBase,
{'__tablename__': self.queue_tablename}
)
@cached_property
def subclient(self):
"""Pub/Sub connection used to consume fanout queues."""
client = self._create_client()
pubsub = client.pubsub()
pool = pubsub.connection_pool
pubsub.connection = pool.get_connection('pubsub', pubsub.shard_hint)
return pubsub
@cached_property
def _not_eager(self):
app = self._app
return not app.conf.CELERY_ALWAYS_EAGER
@cached_property
def _apply_async(self):
try:
return self.type.apply_async
except KeyError:
return _partial(self.app.send_task, self['task'])
id = _getitem_property('options.task_id')
@cached_property
def unacked_key(self):
return self.channel.unacked_key
@cached_property
def timezone(self):
from celery.utils.timeutils import timezone
conf = self.conf
tz = conf.CELERY_TIMEZONE
if not tz:
return (timezone.get_timezone('UTC') if conf.CELERY_ENABLE_UTC
else timezone.local)
return timezone.get_timezone(self.conf.CELERY_TIMEZONE)
App = Celery # compat
@cached_property
def _database_link(self):
return "dbs/" + self._database_name