I'm using redis-py to process bulk insertions into a Redis store.
I wrote the following very simple method:
import redis
def push_metadata_to_redis(list_of_nested_dictionaries):
redis_client = redis.Redis(host='localhost', port=6379, db=0)
redis_pipeline = redis_client.pipeline(transaction=False)
for dictionary in list_of_nested_dictionaries:
for k, inner_dict in dictionary.items()
redis_pipeline.hset(k, mapping=inner_dict)
result = redis_pipeline.execute(raise_on_error=True)
print(result)
Basically it:
- takes in input a list of several thousands dictionaries
- for each of those dictionary, pushes in Redis each key/value item (values are also dictionaries, that's why I'm using
hset
)
Each dictionary
contains ~10k elements, so redis_pipeline.execute(raise_on_error=True)
happens once every ~10k hset
.
I noticed that after few minutes, result
value step from arrays of 0
s to arrays of 4
s and this worries me.
On one side I expect that any error should be raised as Exception (raise_on_error=True
), but on the other side I'm failing to find any reference about this behaviour in the documentation and I don't understand what does that mean.
So my questions are:
- Does
result
equals to an array of4
s mean that something went wrong in theredis_pipeline.execute(raise_on_error=True)
operation? - If yes, how can I understand what went wrong?
- If nope, what does that mean instead?
Thanks in advance.