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

psra_postgres2es.py: configparser.NoOptionError: No option 'version' in section: 'es' #247

Open
anthonyfok opened this issue Apr 2, 2024 · 0 comments
Assignees
Labels
Bug Something isn't working

Comments

@anthonyfok
Copy link
Member

Problem

During a full OpenDRR/opendrr-api stack build with processDSRA=true in .env, I encountered into the following errors at RUN python3 psra_postgres2es.py at ## Load Probabilistic Model Indicators in the export_to_elasticsearch() function:

  • KeyError: 'version'
  • configparser.NoOptionError: No option 'version' in section: 'es'

Error logs:

python-opendrr-1  | [add_data.sh:824:export_to_elasticsearch] ## Load Probabilistic Model Indicators
python-opendrr-1  | [add_data.sh:827:export_to_elasticsearch] Creating PSRA indices in Elasticsearch
python-opendrr-1  | [add_data.sh:828:export_to_elasticsearch] RUN: python3 psra_postgres2es.py
python-opendrr-1  | /usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version!
python-opendrr-1  |   warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
python-opendrr-1  | Traceback (most recent call last):
python-opendrr-1  |   File "/usr/lib/python3.8/configparser.py", line 789, in get
python-opendrr-1  |     value = d[option]
python-opendrr-1  |   File "/usr/lib/python3.8/collections/__init__.py", line 898, in __getitem__
python-opendrr-1  |     return self.__missing__(key)            # support subclasses that define __missing__
python-opendrr-1  |   File "/usr/lib/python3.8/collections/__init__.py", line 890, in __missing__
python-opendrr-1  |     raise KeyError(key)
python-opendrr-1  | KeyError: 'version'
python-opendrr-1  |
python-opendrr-1  | During handling of the above exception, another exception occurred:
python-opendrr-1  |
python-opendrr-1  | Traceback (most recent call last):
python-opendrr-1  |   File "psra_postgres2es.py", line 14, in <module>
python-opendrr-1  |     version = config.get("es", "version")
python-opendrr-1  |   File "/usr/lib/python3.8/configparser.py", line 792, in get
python-opendrr-1  |     raise NoOptionError(option, section)
python-opendrr-1  | configparser.NoOptionError: No option 'version' in section: 'es'
python-opendrr-1  | Command exited with non-zero status 1
python-opendrr-1  | 0.06user 0.02system 0:00.19elapsed 47%CPU (0avgtext+0avgdata 29260maxresident)k
python-opendrr-1  | 23792inputs+16outputs (102major+8797minor)pagefaults 0swaps
python-opendrr-1  |
python-opendrr-1  | real        0m0.193s
python-opendrr-1  | user        0m0.065s
python-opendrr-1  | sys 0m0.027s
python-opendrr-1  |
python-opendrr-1  | real        0m1.317s
python-opendrr-1  | user        0m0.095s
python-opendrr-1  | sys 0m0.034s
python-opendrr-1 exited with code 1

Diagnosis

git log -p python/sample_config.ini

reveals that, in commit d7e0eeb which was squashed merged on 2022-06-20, (i.e. Pull Request #211 addressing Issue #193), or, more specifically, commit 1134f60 dated 2022-06-13 before squashing, the version variable in python/sample_config.ini was replaced with index_version, which is read by python/gen_pygeoapi_config.py:

    version = auth.get("es", "index_version")

It looks like python/psra_postgres2es.py needs a similar edit too.

@anthonyfok anthonyfok added the Bug Something isn't working label Apr 2, 2024
@anthonyfok anthonyfok self-assigned this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant