Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve volumes and logging #202

Merged
merged 5 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions engine/clients/qdrant/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def init_client(cls, host, distance, connection_params: dict, search_params: dic
host,
prefer_grpc=True,
limits=httpx.Limits(max_connections=None, max_keepalive_connections=0),
**connection_params
**connection_params,
)
cls.search_params = search_params

Expand All @@ -50,11 +50,15 @@ def search_one(cls, query: Query, top: int) -> List[Tuple[int, float]]:
),
)

res = cls.client.search(
collection_name=QDRANT_COLLECTION_NAME,
query_vector=query_vector,
query_filter=cls.parser.parse(query.meta_conditions),
limit=top,
search_params=rest.SearchParams(**cls.search_params.get("config", {})),
)
try:
res = cls.client.search(
collection_name=QDRANT_COLLECTION_NAME,
query_vector=query_vector,
query_filter=cls.parser.parse(query.meta_conditions),
limit=top,
search_params=rest.SearchParams(**cls.search_params.get("config", {})),
)
except Exception as ex:
print(f"Something went wrong during search: {ex}")
raise ex
return [(hit.id, hit.score) for hit in res]
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ services:
volumes:
qdrant_storage:
name: "qdrant_storage"
driver: local
driver_opts:
type: none
device: ${PWD}/qdrant_storage
o: bind
6 changes: 2 additions & 4 deletions tools/run_server_container_with_volume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ if [[ ${QDRANT_VERSION} == docker/* ]] || [[ ${QDRANT_VERSION} == ghcr/* ]]; the
fi

if [[ "$EXECUTION_MODE" == "init" ]]; then
# create volume qdrant_storage
echo "Initialize qdrant from scratch"
DOCKER_VOLUME_SET_UP="docker volume rm -f qdrant_storage; sudo rm -rf qdrant_storage; mkdir qdrant_storage"
DOCKER_COMPOSE="export QDRANT_VERSION=${QDRANT_VERSION}; export CONTAINER_REGISTRY=${CONTAINER_REGISTRY}; export CONTAINER_MEM_LIMIT=${CONTAINER_MEM_LIMIT}; docker compose down; pkill qdrant; docker rm -f qdrant-continuous || true; docker rmi -f ${CONTAINER_REGISTRY}/qdrant/qdrant:${QDRANT_VERSION} || true ; ${DOCKER_VOLUME_SET_UP}; docker compose up -d; docker container ls -a"
echo "Initialize qdrant from scratch, with qdrant_storage volume"
DOCKER_COMPOSE="export QDRANT_VERSION=${QDRANT_VERSION}; export CONTAINER_REGISTRY=${CONTAINER_REGISTRY}; export CONTAINER_MEM_LIMIT=${CONTAINER_MEM_LIMIT}; docker compose down; pkill qdrant; docker rm -f qdrant-continuous || true; docker rmi -f ${CONTAINER_REGISTRY}/qdrant/qdrant:${QDRANT_VERSION} || true; docker volume rm -f qdrant_storage || true; docker compose up -d; docker container ls -a"
else
# suggest that volume qdrant_storage exist and start qdrant
echo "Reload qdrant with existing data"
Expand Down
Loading