redis

Received task in django celery beat, but not executed

Received task in django celery beat, but not executed Question: I’m using django with celery, celery beat, and redis to run periodic tasks. The problem I’m having is that tasks registered in celery are received but not executed. Also, the task stops in the middle even though I have not specified a stop setting. The …

Total answers: 2

Redis-py hset() mapping – TypeError when setting multiple item values

Redis-py hset() mapping – TypeError when setting multiple item values Question: I am building some very large lookup tables in Redis. I have some straightforward code that works as intended when looping through a dict to set a single value in my Redis hash (via a pipeline) for each item using hset(): foo = {“1234”: …

Total answers: 3

How to avoid reloading ML model every time when I call python script?

How to avoid reloading ML model every time when I call python script? Question: I have two files, file1.py which have ML model size of 1GB and file2.py which calls get_vec() method from file1 and receives vectors in return. ML model is being loaded everytime when file1 get_vec() method is called. This is where it …

Total answers: 6

Sharing Opencv image between C++ and python using Redis

Sharing Opencv image between C++ and python using Redis Question: I want to share image between C++ and python using Redis. Now I have succeed in sharing numbers. In C++, I use hiredis as the client; in python, I just do import redis. The code I have now is as below: cpp to set value: …

Total answers: 1

Django caching with Redis

Django caching with Redis Question: I have implemented django caching using redis following this blog: https://realpython.com/caching-in-django-with-redis/ So I followed this, installed the package, Added in CACHES = { “default”: { “BACKEND”: “redis_cache.RedisCache”, “LOCATION”: “redis://127.0.0.1:8000/”, “OPTIONS”: { “CLIENT_CLASS”: “django_redis.client.DefaultClient” }, “KEY_PREFIX”: “example” } } Then in views. from django.conf import settings from django.core.cache.backends.base import DEFAULT_TIMEOUT from …

Total answers: 2

How to get the status of celery broker and backend?

How to get the status of celery broker and backend? Question: Is there a clean way in celery for knowing whether its broker and/or the result backend are down or not? I am using celery with RabbitMQ broker and Redis backend. Currently, the easiest way I found is submitting a dummy task which would raise …

Total answers: 2

What are the consequences of disabling gossip, mingle and heartbeat for celery workers?

What are the consequences of disabling gossip, mingle and heartbeat for celery workers? Question: What are the implications of disabling gossip, mingle, and heartbeat on my celery workers? In order to reduce the number of messages sent to CloudAMQP to stay within the free plan, I decided to follow these recommendations. I therefore used the …

Total answers: 3

Check the version of Redis

Check the version of Redis Question: I’d like to check the version of redis, it could be accomplished on command line In [181]: !redis-server –version Redis server v=4.0.10 sha=00000000:0 malloc=libc bits=64 build=ea14acb2d1b3b56f However, when it return the redis-py’s version rather than redis version if In [184]: redis.__version__ Out[184]: ‘2.10.6 It could be achieved in a …

Total answers: 3

How do I to flush redis db from python redis?

How do I to flush redis db from python redis? Question: Is there a way I can flush my redis db using redis? I’m looking for something like redis.flushdb() or redis.flushall() Asked By: Dani Medina || Source Answers: Redis-py actually has this functionality: import redis r = redis.Redis() r.flushdb() Answered By: Aleksandr Borisov Yes, flushdb() …

Total answers: 3

RuntimeError: Never call result.get() within a task Celery

RuntimeError: Never call result.get() within a task Celery Question: I am using celery to send a task to remote server and trying to get the result back. The state of task is constantly updated using update_state method on remote server. I am sending task using app.send_task(‘task_name’) getting results of celery task is a blocking call …

Total answers: 3