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

KeyError thrown with Docker Compose if no params for DocumentStore is defined #3676

Closed
1 task done
bilgeyucel opened this issue Dec 6, 2022 · 0 comments · Fixed by #3930
Closed
1 task done

KeyError thrown with Docker Compose if no params for DocumentStore is defined #3676

bilgeyucel opened this issue Dec 6, 2022 · 0 comments · Fixed by #3930
Labels
Contributions wanted! Looking for external contributions P3 Low priority, leave it in the backlog topic:docker type:bug Something isn't working

Comments

@bilgeyucel
Copy link
Contributor

Describe the bug
I use pipelines.haystack-pipeline.yml file and define an indexing pipeline there. I don't need any params for my DocumentStore. However, when I run the docker-compose.yml file, DOCUMENTSTORE_PARAMS_HOST tries to override the host param of my DocumentStore and throws a KeyError.

Error message

   | Traceback (most recent call last):
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
haystack-haystack-api-1   |     worker.init_process()
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/uvicorn/workers.py", line 66, in init_process
haystack-haystack-api-1   |     super(UvicornWorker, self).init_process()
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
haystack-haystack-api-1   |     self.load_wsgi()
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
haystack-haystack-api-1   |     self.wsgi = self.app.wsgi()
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
haystack-haystack-api-1   |     self.callable = self.load()
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
haystack-haystack-api-1   |     return self.load_wsgiapp()
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
haystack-haystack-api-1   |     return util.import_app(self.app_uri)
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/gunicorn/util.py", line 359, in import_app
haystack-haystack-api-1   |     mod = importlib.import_module(module)
haystack-haystack-api-1   |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
haystack-haystack-api-1   |     return _bootstrap._gcd_import(name[level:], package, level)
haystack-haystack-api-1   |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
haystack-haystack-api-1   |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
haystack-haystack-api-1   |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
haystack-haystack-api-1   |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
haystack-haystack-api-1   |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
haystack-haystack-api-1   |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/rest_api/application.py", line 13, in <module>
haystack-haystack-api-1   |     app = get_app()
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/rest_api/utils.py", line 28, in get_app
haystack-haystack-api-1   |     from rest_api.controller import file_upload, search, feedback, document, health
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/rest_api/controller/file_upload.py", line 20, in <module>
haystack-haystack-api-1   |     indexing_pipeline: Pipeline = get_pipelines().get("indexing_pipeline", None)
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/rest_api/utils.py", line 59, in get_pipelines
haystack-haystack-api-1   |     pipelines = setup_pipelines()
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/rest_api/pipeline/__init__.py", line 28, in setup_pipelines
haystack-haystack-api-1   |     query_pipeline = Pipeline.load_from_yaml(Path(config.PIPELINE_YAML_PATH), pipeline_name=config.QUERY_PIPELINE_NAME)
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/haystack/pipelines/base.py", line 1908, in load_from_yaml
haystack-haystack-api-1   |     return cls.load_from_config(
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/haystack/pipelines/base.py", line 1969, in load_from_config
haystack-haystack-api-1   |     validate_config(pipeline_config, strict_version_check=strict_version_check)
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/haystack/pipelines/config.py", line 245, in validate_config
haystack-haystack-api-1   |     component_definitions = get_component_definitions(
haystack-haystack-api-1   |   File "/opt/venv/lib/python3.10/site-packages/haystack/pipelines/config.py", line 83, in get_component_definitions
haystack-haystack-api-1   |     component_definition["params"][param_name] = value
haystack-haystack-api-1   | KeyError: 'params'

This error stems from /haystack/pipelines/config.py line where component_definition["params"][param_name] = value. The presence of component_definition["params"] should be checked first.

Expected behavior
No error should be thrown and the host param of DocumentStore should be set without any problem

To Reproduce

  1. Define DocumentStore without any params inpipelines.haystack-pipeline.yml file as follows:
  - name: DocumentStore
    type: ElasticsearchDocumentStore
  - name: ...
  1. Define a DOCUMENTSTORE_PARAMS_HOSTvalue in docker-compose.yml file under haystack-api environment
  2. Define volume and PIPELINE_YAML_PATH if necessary. See Loading custom fine-tuned model in REST-API demo #3544 for details.
  3. Run docker-compose up

FAQ Check

System:

  • OS: macOS
  • GPU/CPU: CPU
  • Haystack version (commit or version number): 1.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contributions wanted! Looking for external contributions P3 Low priority, leave it in the backlog topic:docker type:bug Something isn't working
Projects
None yet
3 participants