-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Here is my example to reproduce, using redis==6.4.0 and redisvl==0.10.0 (docker-compose.yml to reproduce here):
import asyncio
import struct
from redis.asyncio.cluster import ClusterNode, RedisCluster
from redisvl.index import AsyncSearchIndex
from redisvl.schema import IndexSchema
SCHEMA = IndexSchema.from_dict(
{
"index": {
"name": "user-index",
"prefix": "user:",
},
"fields": [
{"name": "user", "type": "tag"},
{"name": "credit_score", "type": "tag"},
{
"name": "embedding",
"type": "vector",
"attrs": {
"algorithm": "flat",
"dims": 3,
"distance_metric": "cosine",
"datatype": "float32",
},
},
],
}
)
async def client():
index = AsyncSearchIndex(
SCHEMA,
redis_client=RedisCluster(
startup_nodes=[ClusterNode(host="redis-1", port=6379)],
username=None,
password=None,
client_name="client-issue",
),
)
await index.client.initialize()
await index.create()
keys = await index.load(
[
{
"user": "bob",
"credit_score": "good",
"embedding": struct.pack("3f", 0.1, 0.2, 0.3),
}
],
keys=["user:bob"],
ttl=3600
)
print(f"Inserted: {keys}", flush=True)
asyncio.run(client())Here, nothing is inserted because await pipe.expire() triggers ClusterPipeline.__await__ which empties the command queue.
What is wrong here?
- If there is something wrong in my code example, would be nice to get an error during the initialization.
- If this is a bug in
redis-vl, is it theawaitto remove inawait pipe.expire(), or something else? - By the way, what is the purpose of
ClusterPipeline.__await__inredis-py?
Metadata
Metadata
Assignees
Labels
No labels