kbase / relation_engine

Repository containing the KBase Relation Engine API, specs, and other related files.
MIT License
3 stars 11 forks source link

Raise exceptions when arango client fails and print entire json response #173

Open bio-boris opened 2 years ago

bio-boris commented 2 years ago

During startup, the container fails with a mysterious error

icu_tokenize {'name': 'icu_tokenize', 'type': 'text', 'properties': {'locale': 'en_US', 'accent': False, 'case': 'lower', 'stemming': False, 'stopwords': []}}
Creating analyzer icu_tokenize

...<snip>
Creating analyzer icu_tokenize
Traceback (most recent call last):
  File "./relation_engine_server/utils/pull_spec.py", line 153, in <module>
    download_specs()
  File "./relation_engine_server/utils/pull_spec.py", line 63, in download_specs
    do_init_analyzers()
  File "./relation_engine_server/utils/pull_spec.py", line 105, in do_init_analyzers
    arango_client.create_analyzer(analyzer_name, config)
  File "/app/relation_engine_server/utils/arango_client.py", line 416, in create_analyzer
    raise ArangoServerError(resp.text)
relation_engine_server.utils.arango_client.ArangoServerError: ArangoDB server error.

The actual error is as such

{'code': 409, 'error': True, 'errorMessage': "unique constraint violated - in index primary of type primary over '_key'; conflicting key: icu_tokenize", 'errorNum': 1210}

Reproducible by logging into the container with entrypoint of /bin/sleep args of infinity and adding a print to (resp.json) and running app # PYTHONPATH=.:lib python ./relation_engine_server/utils/pull_spec.py

This issue requests adding exceptions when arango client fails and printing entire json response.