danswer-ai / danswer

Gen-AI Chat for Teams - Think ChatGPT if it had access to your team's unique knowledge.
https://danswer.ai
Other
10.68k stars 1.34k forks source link

celery_app.py: No module named 'backend' #2350

Closed Hurricane31337 closed 2 months ago

Hurricane31337 commented 2 months ago

When looking at the logs, I see the following warning/error getting spammed and the indexing from web connectors often doesn't work:

background-1              | WARNING:  09/06/2024 10:28:23 PM      variable_functionality.py   41: Failed to fetch versioned implementation for danswer.background.celery.celery_app.celery_app: No module named 'backend'
background-1              | 2024-09-06 22:28:24,616 INFO success: document_indexing entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
background-1              | WARNING:  09/06/2024 10:28:24 PM      variable_functionality.py   41: Failed to fetch versioned implementation for danswer.background.celery.celery_app.celery_app: No module named 'backend'

These are the code parts:

celery_run.py:

set_is_ee_based_on_env_variable()
celery_app = fetch_versioned_implementation(
    "danswer.background.celery.celery_app", "celery_app"
)

celery_app.py:

connection_string = build_connection_string(
    db_api=SYNC_DB_API, app_name=POSTGRES_CELERY_APP_NAME
)
celery_broker_url = f"sqla+{connection_string}"
celery_backend_url = f"db+{connection_string}"
celery_app = Celery(__name__, broker=celery_broker_url, backend=celery_backend_url)

Do you have an idea what could be wrong? I checked the container contents and the file /app/danswer/background/celery/celery_app.py is there.

Hurricane31337 commented 2 months ago

Sorry for the confusion, it was due to a wrong import in a new connector I'm developing.

I wrote: from backend.danswer.connectors.web.connector import WebConnector, WEB_CONNECTOR_VALID_SETTINGS

Instead of: from danswer.connectors.web.connector import WebConnector, WEB_CONNECTOR_VALID_SETTINGS

According to the IDE (PyCharm), backend.danswer... is correct, but you have to account for the Dockerfile and location in the container in the end.

Hurricane31337 commented 2 months ago

Closed.