Skip to content

Commit

Permalink
Merge pull request #24 from TranslatorSRI/better_query_runner
Browse files Browse the repository at this point in the history
Better query runner
  • Loading branch information
maximusunc committed Jul 27, 2024
2 parents 72e2b2a + c394ed6 commit 2736c64
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements-runners.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ARS_Test_Runner==0.1.9
ARS_Test_Runner==0.2.3
# benchmarks-runner==0.1.3
# ui-test-runner==0.0.2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="sri-test-harness",
version="0.2.3",
version="0.2.4",
author="Max Wang",
author_email="max@covar.com",
url="https://github.com/TranslatorSRI/TestHarness",
Expand Down
5 changes: 3 additions & 2 deletions test_harness/result_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ def collect_result(

# add result to csv
agent_results = ",".join(
get_tag(report[agent]) for agent in self.agents if agent in report
get_tag(report.get(agent, {"status": "Not queried"}))
for agent in self.agents
)
pk_url = (
f"https://arax.ncats.io/?r={parent_pk}" if parent_pk is not None else ""
)
self.csv += (
f"""{asset.name},{url},{pk_url},{test.id},{asset.id},{agent_results}\n"""
f""""{asset.name}",{url},{pk_url},{test.id},{asset.id},{agent_results}\n"""
)
2 changes: 1 addition & 1 deletion test_harness/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def run_tests(
f"Status code: {response['status_code']}"
)
elif (
response["response"]["message"]["results"] is None
response["response"]["message"].get("results") is None
or len(response["response"]["message"]["results"]) == 0
):
agent_report["status"] = "DONE"
Expand Down
5 changes: 3 additions & 2 deletions test_harness/runner/generate_query.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Given a Test Asset, generate a TRAPI query."""

import copy
from translator_testing_model.datamodel.pydanticmodel import TestAsset

from test_harness.utils import get_qualifier_constraints
Expand Down Expand Up @@ -61,7 +62,7 @@ def generate_query(test_asset: TestAsset) -> dict:
query = {}
if test_asset.predicate_id == "biolink:treats":
# MVP1
query = MVP1
query = copy.deepcopy(MVP1)
# add id to node
if test_asset.input_category == "biolink:Disease":
query["message"]["query_graph"]["nodes"]["ON"]["ids"] = [
Expand All @@ -76,7 +77,7 @@ def generate_query(test_asset: TestAsset) -> dict:
] = "inferred"
elif test_asset.predicate_id == "biolink:affects":
# MVP2
query = MVP2
query = copy.deepcopy(MVP2)
# add id to corresponding node
if test_asset.input_category == "biolink:ChemicalEntity":
query["message"]["query_graph"]["nodes"]["SN"]["ids"] = [
Expand Down
2 changes: 1 addition & 1 deletion test_harness/runner/query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ async def get_ars_responses(
else:
self.logger.info("ARS merging not done, waiting...")
current_time = time.time()
await asyncio.sleep(5)
await asyncio.sleep(10)
else:
self.logger.warning(
f"ARS merging took greater than {MAX_QUERY_TIME / 60} minutes."
Expand Down

0 comments on commit 2736c64

Please sign in to comment.