Skip to content

Commit

Permalink
chore/use redis as broker (#15)
Browse files Browse the repository at this point in the history
* Fix formatting

Signed-off-by: Alex Co <alex.tuan@mindvalley.com>

* User older version of celery

Signed-off-by: Alex Co <alex.tuan@mindvalley.com>

* Fix formatting

Signed-off-by: Alex Co <alex.tuan@mindvalley.com>

---------

Signed-off-by: Alex Co <alex.tuan@mindvalley.com>
  • Loading branch information
onimsha authored Apr 22, 2024
1 parent 5701faf commit 658df0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions backend/danswer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import uvicorn
from fastapi import APIRouter
from fastapi import FastAPI

from fastapi import Request
from fastapi.exceptions import RequestValidationError
from fastapi.middleware.cors import CORSMiddleware
Expand Down Expand Up @@ -224,19 +223,23 @@ async def lifespan(app: FastAPI) -> AsyncGenerator:
logger.info("Verifying Document Index(s) is/are available.")
document_index = get_default_document_index(
primary_index_name=db_embedding_model.index_name,
secondary_index_name=secondary_db_embedding_model.index_name
if secondary_db_embedding_model
else None,
secondary_index_name=(
secondary_db_embedding_model.index_name
if secondary_db_embedding_model
else None
),
)
# Vespa startup is a bit slow, so give it a few seconds
wait_time = 5
for attempt in range(5):
try:
document_index.ensure_indices_exist(
index_embedding_dim=db_embedding_model.model_dim,
secondary_index_embedding_dim=secondary_db_embedding_model.model_dim
if secondary_db_embedding_model
else None,
secondary_index_embedding_dim=(
secondary_db_embedding_model.model_dim
if secondary_db_embedding_model
else None
),
)
break
except Exception:
Expand Down Expand Up @@ -350,7 +353,7 @@ def get_application() -> FastAPI:

def healthz_check():
return True

application.add_api_route("/healthz", health([healthz_check]))

application.add_exception_handler(ValueError, value_error_handler)
Expand Down
2 changes: 1 addition & 1 deletion backend/requirements/default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ alembic==1.10.4
asyncpg==0.27.0
atlassian-python-api==3.37.0
beautifulsoup4==4.12.2
celery[redis]==5.4.0
celery[redis]==5.3.4
chardet==5.2.0
dask==2023.8.1
ddtrace==2.6.5
Expand Down

0 comments on commit 658df0d

Please sign in to comment.