Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/kg2cleanup' #2411
Browse files Browse the repository at this point in the history
  • Loading branch information
amykglen committed Feb 6, 2025
2 parents 734a081 + 2022d45 commit 743100a
Show file tree
Hide file tree
Showing 76 changed files with 198 additions and 10,293 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
run: sudo docker rmi $(sudo docker images -q)

- name: Build docker image
run: sudo docker build --no-cache=true --rm -t rtx:test DockerBuild/ -f DockerBuild/Merged-Dockerfile
run: sudo docker build --no-cache=true --rm -t rtx:test DockerBuild/ -f DockerBuild/CICD-Dockerfile

- name: Run docker container
run: sudo docker run -d -it --name rtx_test -v /mnt/data/orangeboard/databases:/mnt/data/orangeboard/databases -v /mnt/config/config_secrets.json:/mnt/data/orangeboard/production/RTX/code/config_secrets.json rtx:test
Expand Down
20 changes: 0 additions & 20 deletions DockerBuild/Merged-Dockerfile → DockerBuild/CICD-Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,3 @@ RUN update-rc.d RTX_Complete defaults

# setup config.domain
RUN su rt && cd /mnt/data/orangeboard/production/RTX/code/ && echo "Github actions ARAX test suite" > config.domain

# Setup KG2

# clone RTX repo into KG2
RUN mkdir -p /mnt/data/orangeboard/kg2
RUN chown -R rt.rt /mnt/data/orangeboard/kg2
RUN su rt && cd /mnt/data/orangeboard/kg2 && git clone https://github.com/RTXteam/RTX.git
RUN chown -R rt.rt /mnt/data/orangeboard/kg2/RTX
COPY kg2-config.js /mnt/data/orangeboard/kg2/RTX/code/UI/interactive/config.js

# setup KG2 services
RUN export DEVAREA=kg2
RUN cat /mnt/data/orangeboard/kg2/RTX/code/UI/OpenAPI/python-flask-server/KG2/RTX_OpenAPI_kg2 > /etc/init.d/RTX_OpenAPI_kg2
RUN chmod 700 /etc/init.d/RTX_OpenAPI_kg2
RUN update-rc.d RTX_OpenAPI_kg2 defaults
RUN ln -s /mnt/data/orangeboard/kg2/RTX/code/UI/interactive /var/www/html/kg2

# setup config.domain
RUN su rt && cd /mnt/data/orangeboard/kg2/RTX/code/ && echo "Github actions ARAX test suite" > config.domain

2 changes: 1 addition & 1 deletion DockerBuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ RUN cd /mnt/data/orangeboard/production/RTX/code/autocomplete && sed -i 's/devED
RUN update-rc.d RTX_Complete defaults

# setup config.domain
RUN su rt && cd /mnt/data/orangeboard/production/RTX/code/ && echo "arax.ci.transltr.io" > config.domain
RUN su rt && cd /mnt/data/orangeboard/production/RTX/code/ && echo "arax.ci.transltr.io" > config.domain
74 changes: 0 additions & 74 deletions DockerBuild/KG2-Dockerfile

This file was deleted.

7 changes: 5 additions & 2 deletions code/ARAX/ARAXQuery/ARAX_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self):
self.array_delimiter_char = "ǂ"
self.kg2_infores_curie = "infores:rtx-kg2" # Can't use expand_utilities.py here due to circular imports

def decorate_nodes(self, response: ARAXResponse) -> ARAXResponse:
def decorate_nodes(self, response: ARAXResponse, only_decorate_bare: bool = False) -> ARAXResponse:
message = response.envelope.message
response.debug(f"Decorating nodes with metadata from KG2c")

Expand All @@ -67,7 +67,10 @@ def decorate_nodes(self, response: ARAXResponse) -> ARAXResponse:
# Extract the KG2c nodes from sqlite
response.debug(f"Looking up corresponding KG2c nodes in sqlite")
node_attributes_ordered = list(self.node_attributes)
node_keys = set(node_key.replace("'", "''") for node_key in message.knowledge_graph.nodes) # Escape quotes
node_keys = set(node_key.replace("'", "''") for node_key, node in message.knowledge_graph.nodes.items() # Escape quotes
if not only_decorate_bare or not any(attribute for attribute in node.attributes
if attribute.attribute_type_id == "biolink:description"))
response.debug(f"Identified {len(node_keys)} nodes to decorate (only_decorate_bare={only_decorate_bare})")
node_keys_str = "','".join(node_keys) # SQL wants ('node1', 'node2') format for string lists
node_cols_str = ", ".join([f"N.{property_name}" for property_name in node_attributes_ordered])
sql_query = f"SELECT N.id, {node_cols_str} " \
Expand Down
Loading

0 comments on commit 743100a

Please sign in to comment.