Skip to content

Commit

Permalink
Merge pull request #2118 from RTXteam/issue-2114
Browse files Browse the repository at this point in the history
  • Loading branch information
saramsey authored Aug 29, 2023
2 parents 2f76900 + 3cb68df commit fdf9625
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions code/ARAX/ARAXQuery/Expand/kg2_querier.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import time
from collections import defaultdict
from typing import Dict, Tuple, Union, Set

import requests
import traceback

sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import expand_utilities as eu
Expand Down Expand Up @@ -183,13 +183,21 @@ def _answer_query_using_plover(qg: QueryGraph, log: ARAXResponse) -> Tuple[Dict[
qnode["allow_subclasses"] = True
# Then send the actual query
log.debug(f"Sending query to {rtxc.plover_url}")
response = requests.post(f"{rtxc.plover_url}/query", json=dict_qg, timeout=60,
headers={'accept': 'application/json'})
try:
response = requests.post(f"{rtxc.plover_url}/query",
json=dict_qg,
timeout=60,
headers={'accept': 'application/json'})
except Exception as e:
log.error(f"Error querying PloverDB: {e} "
f"TRACE {traceback.format_exc()}")
raise e
if response.status_code == 200:
log.debug(f"Got response back from Plover")
log.debug(f"Plover returned status code {response.status_code}")
return response.json(), response.status_code
else:
log.warning(f"Plover returned a status code of {response.status_code}. Response was: {response.text}")
log.warning(f"Plover returned status code {response.status_code}."
f" Response was: {response.text}")
return dict(), response.status_code

def _load_plover_answer_into_object_model(self, plover_answer: Dict[str, Dict[str, Union[set, dict]]],
Expand Down

0 comments on commit fdf9625

Please sign in to comment.