Skip to content

Commit

Permalink
Fixing tests, skipping das-node
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiebrissow committed Dec 12, 2024
1 parent 93f1a38 commit 57f354f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docker_das_node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ARG BAZEL_DIR="${BASE_DIR}/bazel"
ARG THIRDPARTY="${BASE_DIR}/3rd-party"
# ARG AB_COMMIT="2a25871028268b0b9518d2da2a9d9f29ecfcbb4d"
# ARG AB_COMMIT="senna-agi-meetup-stable"
ARG AB_COMMIT="senna-agi-meetup-1"
# ARG AB_COMMIT="senna-agi-meetup-1"
ARG AB_COMMIT="edgar-agi-meetup-1"

RUN mkdir -p ${DATA_DIR}
RUN mkdir -p ${GRPC_DIR}
Expand Down
1 change: 0 additions & 1 deletion hyperon_das/das_node/query_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def message_factory(self, command: str, args: List[str]) -> Optional[Message]:
return QueryAnswerFlow(command, args)
elif command == QueryNode.QUERY_ANSWER_TOKENS_FLOW_COMMAND:
return QueryAnswerTokensFlow(command, args)

elif command == QueryNode.QUERY_ANSWERS_FINISHED_COMMAND:
return QueryAnswersFinished(command, args)
return None
Expand Down
1 change: 0 additions & 1 deletion hyperon_das/query_engines/das_node_query_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def wrapper(*args, **kwargs):
yield from function(*args, **kwargs)
break
except Exception as e:
print(f"Retrying {r + 1}")
if r == retries - 1:
raise e

Expand Down
21 changes: 17 additions & 4 deletions tests/integration/test_node_das.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
from hyperon_das.das import DistributedAtomSpace


@pytest.mark.skip(reason="Add query broker to Dockerfile")
class TestNodeDAS:
timeout = 5

@pytest.fixture
def remote_das(self):
yield DistributedAtomSpace(
Expand Down Expand Up @@ -112,7 +115,9 @@ def remote_das(self):
],
)
def test_node_das(self, query, expected):
das = DistributedAtomSpace(query_engine="grpc", host="localhost", port=35700)
das = DistributedAtomSpace(
query_engine="grpc", host="localhost", port=35700, timeout=self.timeout
)
count = 0
for q in das.query(query, {"tokenize": False}):
assert isinstance(q, list)
Expand Down Expand Up @@ -197,7 +202,11 @@ def test_node_das(self, query, expected):
)
def test_node_das_query_og(self, query, expected, remote_das: DistributedAtomSpace):
das = DistributedAtomSpace(
query_engine="grpc", host="localhost", port=35700, timeout=5, remote_das=remote_das
query_engine="grpc",
host="localhost",
port=35700,
timeout=self.timeout,
remote_das=remote_das,
)
redis_mongo_return = list(remote_das.query(query))
rm_list = [
Expand Down Expand Up @@ -226,7 +235,9 @@ def test_node_das_query_og(self, query, expected, remote_das: DistributedAtomSpa
],
)
def test_query_links_nodes_var(self, nodes, link_type):
das = DistributedAtomSpace(query_engine="grpc", host="localhost", port=35700)
das = DistributedAtomSpace(
query_engine="grpc", host="localhost", port=35700, timeout=self.timeout
)
nodes = nodes.split(',')
queries = []
for i, node in enumerate(nodes):
Expand Down Expand Up @@ -264,7 +275,9 @@ def test_query_links_nodes_var(self, nodes, link_type):
],
)
def test_node_das_query_async(self, query, expected, remote_das: DistributedAtomSpace):
das = DistributedAtomSpace(query_engine="grpc", host="localhost", port=35700, timeout=5)
das = DistributedAtomSpace(
query_engine="grpc", host="localhost", port=35700, timeout=self.timeout
)
iterator = das.query_engine.query_async(query)
while not iterator.finished():
while (qs := next(iterator)) is None:
Expand Down

0 comments on commit 57f354f

Please sign in to comment.