Hi @mart.ratas , can you help me once again please?!
The service runs as far as flask and pydantic are concerned. However, the env variables from ./envs/env_app do not seem to be used/set (see error below). When submitting a query via curl, an error is reported that APP_MEDCAT_MODEL_PACK and APP_MODEL_VOCAB_PATH are not specified although the are.
I recreated the âmodelsâ directory to contain the same files and dirs as in my (working) medcat docker container. I cannot find where the env files are sourced/read, and if I source them myself at the beginning of start-service-prod.sh I get the same error. The model_pac zip file is the same as in my docker container.
[2023-12-07 10:06:22,343] [INFO] MedCatProcessor: Initializing MedCAT processor ...
[2023-12-07 10:06:23,608] [INFO] MedCatProcessor: APP_MEDCAT_MODEL_PACK not set, skipping....
[2023-12-07 10:06:23,609] [ERROR] medcat_service.app.app: Exception on /api/process [POST]
Traceback (most recent call last):
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 783, in get
return self._context[key]
~~~~~~~~~~~~~^^^^^
KeyError: <class 'medcat_service.nlp_service.nlp_service.NlpService'>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 783, in get
return self._context[key]
~~~~~~~~~~~~~^^^^^
KeyError: <class 'medcat_service.nlp_processor.medcat_processor.MedCatProcessor'>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/flask_injector/__init__.py", line 89, in wrapper
return injector.call_with_injection(callable=fun, args=args, kwargs=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 999, in call_with_injection
dependencies = self.args_to_inject(
^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 1047, in args_to_inject
instance: Any = self.get(interface)
^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 943, in get
result = scope_instance.get(interface, binding.provider).get(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 785, in get
provider = InstanceProvider(provider.get(self.injector))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
return injector.create_object(self._cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 966, in create_object
self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 999, in call_with_injection
dependencies = self.args_to_inject(
^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 1047, in args_to_inject
instance: Any = self.get(interface)
^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 943, in get
result = scope_instance.get(interface, binding.provider).get(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 785, in get
provider = InstanceProvider(provider.get(self.injector))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
return injector.create_object(self._cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 966, in create_object
self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
File "/trinity/home/tgwelter/environments/mdcservice/lib/python3.11/site-packages/injector/__init__.py", line 1008, in call_with_injection
return callable(*full_args, **dependencies)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/MedCATservice/medcat_service/nlp_processor/medcat_processor.py", line 65, in __init__
self.cat = self._create_cat()
^^^^^^^^^^^^^^^^^^
File "/trinity/home/tgwelter/MedCATservice/medcat_service/nlp_processor/medcat_processor.py", line 240, in _create_cat
raise ValueError("Vocabulary (env: APP_MODEL_VOCAB_PATH) not specified")
ValueError: Vocabulary (env: APP_MODEL_VOCAB_PATH) not specified
[07/Dec/2023:10:06:23 +0100] [ACCESSS] 127.0.0.1 "POST /api/process HTTP/1.1" 500 "-" "curl/7.61.1"