Please get with me a tgz with MeTTa knowledge base and the test script issuing the error (didn't add here because it's too large).
To reproduce:
Create a local server environment using das-cli
Load the given metta knowledge base
Run the given test script
The script just does 2 queries. Both look for link(s). In the first query, all targets are set so no need to call redis. In the second one, a variable is passed as one of the targets so redis' patterns is queried and LazyQueryEvaluator is called.
Here's the test script:
from hyperon_das import DistributedAtomSpace
host = '0.0.0.0'
port = '8080'
query_params = {
"toplevel_only": False,
"no_iterator": True,
# "chunk_size": 100,
}
das = DistributedAtomSpace(query_engine='remote', host=host, port=port)
print(f"Connected to DAS at {host}:{port}")
q1 = {
"atom_type": "link",
"type": "Expression",
"targets": [
{"atom_type": "node", "type": "Symbol", "name": "gene_group"},
{"atom_type": "node", "type": "Symbol", "name": "FBgg0001558"},
]
}
q2 = {
"atom_type": "link",
"type": "Expression",
"targets": [
{"atom_type": "node", "type": "Symbol", "name": "gene_group"},
{"atom_type": "variable", "name": "v2"},
]
}
for qa in das.query(q1, query_params):
print(qa)
for qa in das.query(q2, query_params):
print(qa)
[ninjato] teste_saulo > python3 test1.py
Connected to DAS at 0.0.0.0:8080
QueryAnswer(subgraph={'handle': '8a767e1c7698952cd03e04b63482d532', 'type': 'Expression', 'composite_type_hash': 'e741de9de620cc6ca1c96d4249d4fec8', 'is_toplevel': True, 'composite_type': ['a1a6657be79cc0fc1e9b23b9e108f043', '02c86eb2792f3262c21d030a87e19793', '02c86eb2792f3262c21d030a87e19793'], 'named_type': 'Expression', 'named_type_hash': 'a1a6657be79cc0fc1e9b23b9e108f043', 'targets': [{'handle': 'db37c407bcfcdf3a392cb029ce268de9', 'type': 'Symbol', 'composite_type_hash': '02c86eb2792f3262c21d030a87e19793', 'name': 'gene_group', 'named_type': 'Symbol', 'is_literal': False}, {'handle': 'd49d4434531db744a54556fe23ef4cc8', 'type': 'Symbol', 'composite_type_hash': '02c86eb2792f3262c21d030a87e19793', 'name': 'FBgg0001558', 'named_type': 'Symbol', 'is_literal': False}]}, assignment=None)
Traceback (most recent call last):
File "/home/senna/.local/lib/python3.10/site-packages/hyperon_das/client.py", line 43, in _send_request
response.raise_for_status()
File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://0.0.0.0:8080/function/query-engine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/teste_saulo/test1.py", line 35, in <module>
for qa in das.query(q2, query_params):
File "/home/senna/.local/lib/python3.10/site-packages/hyperon_das/das.py", line 550, in query
return self.query_engine.query(query, parameters)
File "/home/senna/.local/lib/python3.10/site-packages/hyperon_das/query_engines/remote_query_engine.py", line 122, in query
answer = self.remote_das.query(query, parameters)
File "/home/senna/.local/lib/python3.10/site-packages/hyperon_das/client.py", line 147, in query
raise e
File "/home/senna/.local/lib/python3.10/site-packages/hyperon_das/client.py", line 137, in query
return self._send_request(payload)
File "/home/senna/.local/lib/python3.10/site-packages/hyperon_das/client.py", line 73, in _send_request
das_error(
File "/home/senna/.local/lib/python3.10/site-packages/hyperon_das/utils.py", line 23, in das_error
raise exception
hyperon_das.exceptions.HTTPError: ('Please, check if your request payload is correctly formatted.', {'error': "module 'hyperon_das_atomdb.exceptions' has no attribute 'LinkDoesNotExist'"})
Here's the error from openfaas logs:
2024/08/22 12:55:08 stderr: ERROR:root:Failed to retrieve atom for handle: 9a1ddc0cc768515376936762da1672fc. This atom does not exist. - Details: {}
2024/08/22 12:55:08 stderr: ERROR:root:('Nonexistent atom', 'handle: 9a1ddc0cc768515376936762da1672fc')
2024/08/22 12:55:08 stderr: ERROR:root:module 'hyperon_das_atomdb.exceptions' has no attribute 'LinkDoesNotExist'
2024/08/22 12:55:08 stderr: Traceback (most recent call last):
2024/08/22 12:55:08 stderr: File "/home/app/actions.py", line 177, in query
2024/08/22 12:55:08 stderr: return self.das.query(query, parameters), HTTPStatus.OK
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das/das.py", line 550, in query
2024/08/22 12:55:08 stderr: return self.query_engine.query(query, parameters)
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das/query_engines/local_query_engine.py", line 272, in query
2024/08/22 12:55:08 stderr: answer = [result for result in query_results]
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das/query_engines/local_query_engine.py", line 272, in <listcomp>
2024/08/22 12:55:08 stderr: answer = [result for result in query_results]
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das/cache/iterators.py", line 146, in __next__
2024/08/22 12:55:08 stderr: QueryAnswer(self._replace_target_handles(answer), assignment)
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das/cache/iterators.py", line 99, in _replace_target_handles
2024/08/22 12:55:08 stderr: atom = self.query_engine.get_atom(target_handle)
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das/query_engines/local_query_engine.py", line 209, in get_atom
2024/08/22 12:55:08 stderr: das_error(exception)
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das/utils.py", line 23, in das_error
2024/08/22 12:55:08 stderr: raise exception
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das/query_engines/local_query_engine.py", line 207, in get_atom
2024/08/22 12:55:08 stderr: return self.local_backend.get_atom(handle, **kwargs)
2024/08/22 12:55:08 stderr: File "/home/app/.local/lib/python3.10/site-packages/hyperon_das_atomdb/database.py", line 643, in get_atom
2024/08/22 12:55:08 stderr: raise AtomDoesNotExist(
2024/08/22 12:55:08 stderr: hyperon_das_atomdb.exceptions.AtomDoesNotExist: ('Nonexistent atom', 'handle: 9a1ddc0cc768515376936762da1672fc')
2024/08/22 12:55:08 stderr:
2024/08/22 12:55:08 stderr: During handling of the above exception, another exception occurred:
2024/08/22 12:55:08 stderr:
2024/08/22 12:55:08 stderr: Traceback (most recent call last):
2024/08/22 12:55:08 stderr: File "/home/app/handler.py", line 40, in handle
2024/08/22 12:55:08 stderr: result, http_code_response, elapsed_time = action_dispatcher.dispatch(
2024/08/22 12:55:08 stderr: File "/home/app/action_dispatcher.py", line 33, in dispatch
2024/08/22 12:55:08 stderr: return action(**payload)
2024/08/22 12:55:08 stderr: File "/home/app/utils/decorators.py", line 21, in wrapper
2024/08/22 12:55:08 stderr: result, status_code = func(*args, **kwargs)
2024/08/22 12:55:08 stderr: File "/home/app/utils/decorators.py", line 12, in wrapper
2024/08/22 12:55:08 stderr: return func(*new_args, **new_kwargs)
2024/08/22 12:55:08 stderr: File "/home/app/actions.py", line 178, in query
2024/08/22 12:55:08 stderr: except (atom_db_exceptions.LinkDoesNotExist, atom_db_exceptions.AtomDoesNotExist) as e:
2024/08/22 12:55:08 stderr: AttributeError: module 'hyperon_das_atomdb.exceptions' has no attribute 'LinkDoesNotExist'
Please get with me a tgz with MeTTa knowledge base and the test script issuing the error (didn't add here because it's too large).
To reproduce:
The script just does 2 queries. Both look for link(s). In the first query, all targets are set so no need to call redis. In the second one, a variable is passed as one of the targets so redis' patterns is queried and LazyQueryEvaluator is called.
Here's the test script:
Here's the environment:
Here's the error on tty:
Here's the error from openfaas logs: