celery-singleton icon indicating copy to clipboard operation
celery-singleton copied to clipboard

Exception when Celery uses Redis Sentinel

Open K-MTG opened this issue 4 years ago • 0 comments

If my celery broker_url is configured for Redis Sentinel (per celery documentation):

app.conf.broker_url = 'sentinel://:password@localhost:26379;sentinel://:password@localhost:26380;sentinel://:password@localhost:26381'
app.conf.broker_transport_options = { 'master_name': "cluster1", sentinel_kwargs': {'password': 'password'} }

I get the following exception:

venv/lib/python3.9/site-packages/celery_singleton/singleton.py", line 106, in apply_async
    task = self.lock_and_run(**run_args)
venv/lib/python3.9/site-packages/celery_singleton/singleton.py", line 119, in lock_and_run
    lock_aquired = self.aquire_lock(lock, task_id)
venv/lib/python3.9/site-packages/celery_singleton/singleton.py", line 51, in aquire_lock
    return self.singleton_backend.lock(lock, task_id, expiry=expiry)
venv/lib/python3.9/site-packages/celery_singleton/singleton.py", line 42, in singleton_backend
    self._singleton_backend = get_backend(self.singleton_config)
venv/lib/python3.9/site-packages/celery_singleton/backends/__init__.py", line 22, in get_backend
    _backend = klass(url, **kwargs)
venv/lib/python3.9/site-packages/celery_singleton/backends/redis.py", line 11, in __init__
    self.redis = Redis.from_url(*args, decode_responses=True, **kwargs)
venv/lib/python3.9/site-packages/redis/client.py", line 696, in from_url
    connection_pool = ConnectionPool.from_url(url, db=db, **kwargs)
venv/lib/python3.9/site-packages/redis/connection.py", line 1051, in from_url
    raise ValueError('Redis URL must specify one of the following '
ValueError: Redis URL must specify one of the following schemes (redis://, rediss://, unix://)

K-MTG avatar Jan 21 '21 21:01 K-MTG