Skip to content

Commit

Permalink
Fix logs by handling case where ara agent results aren't present
Browse files Browse the repository at this point in the history
  • Loading branch information
maximusunc committed Jun 25, 2024
1 parent 13f26ef commit 75a4adf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
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.1.15",
version="0.1.16",
author="Max Wang",
author_email="[email protected]",
url="https://github.com/TranslatorSRI/TestHarness",
Expand Down
11 changes: 6 additions & 5 deletions test_harness/result_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ def collect_result(self, test: TestCase, asset: TestAsset, result: dict, url: st
# add result to stats
for agent in result["result"]:
query_type = asset.expected_output
result_type = self.result_types.get(
get_tag(result["result"][agent]), "Test Error"
)
self.stats[agent][query_type][result_type] += 1
if agent in self.agents:
result_type = self.result_types.get(
get_tag(result["result"][agent]), "Test Error"
)
self.stats[agent][query_type][result_type] += 1

# add result to csv
agent_results = ",".join(
get_tag(result["result"][agent]) for agent in self.agents
get_tag(result["result"].get(agent, {"status": "Not queried"})) for agent in self.agents
)
ars_pk = result["pks"].get("parent_pk", None)
pk_url = f"https://arax.ncats.io/?r={ars_pk}" if ars_pk is not None else ""
Expand Down
2 changes: 1 addition & 1 deletion test_harness/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ async def run_tests(
try:
await reporter.upload_log(
test_id,
f"Failed to parse results: {json.dumps(ars_result)}",
f"Failed to parse results: {json.dumps(ars_result, indent=4)}",
)
except Exception as e:
logger.error(f"[{test.id}] failed to upload failure log.")
Expand Down

0 comments on commit 75a4adf

Please sign in to comment.