Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
cba10f7
Using Pathfinder package with local sqlite files
mohsenht Jan 20, 2026
5539e3d
Using Pathfinder package with mysql server
mohsenht Jan 21, 2026
cf94d6d
Settings for arax pathfinder
mohsenht Jan 21, 2026
4999dff
Black style errors
mohsenht Jan 21, 2026
767e51b
Black style errors
mohsenht Jan 21, 2026
540f220
New pathfinder package release update.
mohsenht Jan 23, 2026
cd4cf5a
Inject shepherd-arax provenance in all edge sources field
mohsenht Jan 24, 2026
ce1a5e6
Temporary faster pathfinder by decreasing parameters
mohsenht Feb 4, 2026
7cd663a
Merge branch 'main' of github.com:BioPack-team/shepherd into arax-pat…
mohsenht Feb 11, 2026
8ec57a9
Arax Pathfinder tested with 4 hops
mohsenht Feb 11, 2026
82852c4
Async Arax Pathfinder
mohsenht Feb 18, 2026
6b537e5
Pathfinder package updated
mohsenht Mar 3, 2026
9919306
Pathfinder package updated
mohsenht Mar 4, 2026
ab7049e
Merge branch 'main' of github.com:BioPack-team/shepherd into arax-pat…
mohsenht Mar 11, 2026
4771f90
resolved conflicts
mohsenht Mar 11, 2026
107614b
resolved conflicts
mohsenht Mar 11, 2026
268d226
resolved conflicts
mohsenht Mar 11, 2026
c6b79c3
Update to latest main code
maximusunc Mar 11, 2026
f98c6e9
Run black
maximusunc Mar 11, 2026
298aee5
PloverDB url updated to point to CI
mohsenht Mar 11, 2026
17d4187
Merge remote-tracking branch 'origin/arax-pathfinder' into arax-pathf…
mohsenht Mar 11, 2026
70758cb
PRUNE more
mohsenht Mar 11, 2026
b048766
Merge branch 'main' of github.com:BioPack-team/shepherd into arax-pat…
mohsenht Apr 30, 2026
60b7d4a
Merge branch 'main' of github.com:BioPack-team/shepherd into arax-pat…
mohsenht Jul 6, 2026
a7ab6be
Async call
mohsenht Jul 16, 2026
d344b95
Merge branch 'main' of github.com:BioPack-team/shepherd into arax-pat…
mohsenht Jul 16, 2026
ebff3e6
Merge branch 'main' of github.com:BioPack-team/shepherd into arax-pat…
mohsenht Jul 23, 2026
a3eb40d
ARAX Pathfinder Package 2.4.3. Adaptable with Retriever
mohsenht Jul 23, 2026
7bc9ba2
Auto download sqlite files for developers
mohsenht Jul 29, 2026
a3f35df
Merge branch 'main' of github.com:BioPack-team/shepherd into arax-pat…
mohsenht Jul 29, 2026
b823e96
redundant plover_url config removed.
mohsenht Jul 29, 2026
5195035
ssh path generalized for all developers
mohsenht Jul 29, 2026
c699d27
readme correction
mohsenht Jul 29, 2026
cbd9ad5
Fetch sqlite files over Https instead of scp
mohsenht Aug 5, 2026
7a0730f
arax_pathfinder_dbs git ignored
mohsenht Aug 5, 2026
d41090f
Run black
maximusunc Aug 5, 2026
ff282dc
Fix test import
maximusunc Aug 10, 2026
8c26f47
Move arax_pathfinder onto a process pool and run_task_lifecycle
claude Aug 10, 2026
78d17af
Add script for testing against pathfinder
maximusunc Aug 10, 2026
a782c5f
Set arax pathfinder resources
maximusunc Aug 10, 2026
e6ff46d
Merge pull request #137 from BioPack-team/claude/async-arax-pathfinde…
mohsenht Aug 12, 2026
6fbd183
Add arax pathfinder to release
maximusunc Aug 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,20 @@ services:
volumes:
- ./logs:/app/logs
- ./.env:/app/.env
arax_pathfinder:
container_name: arax_pathfinder
build:
context: .
dockerfile: workers/arax_pathfinder/Dockerfile
restart: unless-stopped
depends_on:
shepherd_db:
condition: service_healthy
shepherd_broker:
condition: service_healthy
volumes:
- ./logs:/app/logs
- ./.env:/app/.env

######### BTE
bte:
Expand Down
1 change: 0 additions & 1 deletion shepherd_server/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import uvicorn


if __name__ == "__main__":
uvicorn.run(
"shepherd_server.server:APP",
Expand Down
16 changes: 16 additions & 0 deletions shepherd_utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ class Settings(BaseSettings):
sync_kg_retrieval_url: str = "https://strider.renci.org/query"
default_data_tier: int = 0
omnicorp_url: str = "https://aragorn-ranker.renci.org/omnicorp_overlay"

# ARAX configs
arax_url: str = "https://arax.ncats.io/shepherd/api/arax/v1.4/query"
plover_url: str = "https://kg2cplover3.rtx.ai:9990"
curie_ngd_addr: str = (
"mysql:arax-databases-mysql.rtx.ai:public_ro:curie_ngd_v1_0_kg2_10_2"
)
node_degree_addr: str = (
"mysql:arax-databases-mysql.rtx.ai:public_ro:kg2c_v1_0_kg2_10_2"
)
arax_biolink_version: str = "4.2.5"
arax_blocked_list_url: str = (
"https://raw.githubusercontent.com/RTXteam/RTX/master/"
"code/ARAX/KnowledgeSources/general_concepts.json"
)
# End of ARAX configs

node_norm: str = "https://biothings.ci.transltr.io/nodenorm/api/"

pathfinder_redis_host: str = "host.docker.internal"
Expand Down
46 changes: 46 additions & 0 deletions shepherd_utils/inject_shepherd_arax_provenance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from __future__ import annotations

from typing import Any, Dict


SHEPHERD_ARAX_SOURCE = {
"resource_id": "infores:shepherd-arax",
"resource_role": "aggregator_knowledge_source",
"source_record_urls": None,
"upstream_resource_ids": ["infores:arax"],
}


def add_shepherd_arax_to_edge_sources(trapi_response: Dict[str, Any]) -> Dict[str, Any]:
message = trapi_response.get("message")
if not isinstance(message, dict):
return trapi_response

kg = message.get("knowledge_graph")
if not isinstance(kg, dict):
return trapi_response

edges = kg.get("edges")
if not isinstance(edges, dict):
return trapi_response

for edge_id, edge_obj in edges.items():
if not isinstance(edge_obj, dict):
continue

sources = edge_obj.get("sources")
if sources is None:
edge_obj["sources"] = [dict(SHEPHERD_ARAX_SOURCE)]
continue

if not isinstance(sources, list):
continue

already_present = any(
isinstance(s, dict) and s.get("resource_id") == "infores:shepherd-arax"
for s in sources
)
if not already_present:
sources.append(dict(SHEPHERD_ARAX_SOURCE))

return trapi_response
62 changes: 40 additions & 22 deletions workers/arax/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from shepherd_utils.db import get_message, save_message
from shepherd_utils.shared import get_tasks, wrap_up_task
from shepherd_utils.otel import setup_tracer
from shepherd_utils.inject_shepherd_arax_provenance import add_shepherd_arax_to_edge_sources

# Queue name
STREAM = "arax"
Expand All @@ -18,33 +19,50 @@
tracer = setup_tracer(STREAM)


async def arax(task, logger: logging.Logger):
def is_pathfinder_query(message):
try:
start = time.time()
query_id = task[1]["query_id"]
logger.info(f"Getting message from db for query id {query_id}")
message = await get_message(query_id, logger)
message["submitter"] = "Shepherd"
logger.info(f"Get the message from db {message}")

headers = {"Content-Type": "application/json"}
response = requests.post(settings.arax_url, json=message, headers=headers)

logger.info(f"Status Code from ARAX response: {response.status_code}")
result = response.json()

except Exception as e:
logger.error(f"Error occurred in ARAX entry module: {e}")
result = {"status": "error", "error": str(e)}

response_id = task[1]["response_id"]
# this can still fail if the input looks like e.g.:
# "query_graph": None
qedges = message.get("message", {}).get("query_graph", {}).get("edges", {})
except:
qedges = {}
try:
# this can still fail if the input looks like e.g.:
# "query_graph": None
qpaths = message.get("message", {}).get("query_graph", {}).get("paths", {})
except:
qpaths = {}
if len(qpaths) > 1:
raise Exception("Only a single path is supported", 400)
if (len(qpaths) > 0) and (len(qedges) > 0):
raise Exception("Mixed mode pathfinder queries are not supported", 400)
return len(qpaths) == 1

await save_message(response_id, result, logger)

workflow = [{"id": "arax"}]
async def arax(task, logger: logging.Logger):
start = time.time()
query_id = task[1]["query_id"]
logger.info(f"Getting message from db for query id {query_id}")
message = await get_message(query_id, logger)
if is_pathfinder_query(message):
workflow = [{"id": "arax.pathfinder"}]
Comment thread
dkoslicki marked this conversation as resolved.
Outdated
else:
try:
workflow = [{"id": "arax"}]
message["submitter"] = "Shepherd"
logger.info(f"Get the message from db {message}")
headers = {"Content-Type": "application/json"}
response = requests.post(settings.arax_url, json=message, headers=headers)
logger.info(f"Status Code from ARAX response: {response.status_code}")
result = response.json()
result = add_shepherd_arax_to_edge_sources(result)
except Exception as e:
logger.error(f"Error occurred calling ARAX service: {e}")
result = {"status": "error", "error": str(e)}
response_id = task[1]["response_id"]
await save_message(response_id, result, logger)

await wrap_up_task(STREAM, GROUP, task, workflow, logger)

logger.info(f"Finished task {task[0]} in {time.time() - start}")


Expand Down
34 changes: 34 additions & 0 deletions workers/arax_pathfinder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Use RENCI python base image
FROM ghcr.io/translatorsri/renci-python-image:3.11.5

# Add image info
LABEL org.opencontainers.image.source https://github.com/BioPack-team/shepherd

ENV PYTHONHASHSEED=0

# set up requirements
WORKDIR /app

# make sure all is writeable for the nru USER later on
RUN chmod -R 777 .

# Install requirements
COPY ./shepherd_utils ./shepherd_utils
COPY ./pyproject.toml .
RUN pip install .

COPY ./workers/arax_pathfinder/requirements.txt .
RUN pip install -r requirements.txt

# switch to the non-root user (nru). defined in the base image
USER nru

# Copy in files
COPY ./workers/arax_pathfinder ./

# Set up base for command and any variables
# that shouldn't be modified
# ENTRYPOINT ["uvicorn", "shepherd_server.server:APP"]

# Variables that can be overriden
CMD ["python", "worker.py"]
Empty file.
2 changes: 2 additions & 0 deletions workers/arax_pathfinder/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
catrax-pathfinder==1.1.1
biolink-helper-pkg==1.0.0
Loading
Loading