Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #463

Merged
merged 6 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ logs/*
*.log
data/
.dir-locals.el

# local development folders
test_queries/
scripts/
.idea
artifacts/
8 changes: 7 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import uvicorn

if __name__ == "__main__":
uvicorn.run("strider.server:APP", host="0.0.0.0", port=5781, reload=True)
uvicorn.run(
"strider.server:APP",
host="0.0.0.0",
port=5781,
reload=True,
reload_dirs=["strider"],
)
20 changes: 13 additions & 7 deletions strider/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
title="Strider",
description=DESCRIPTION,
docs_url=None,
version="4.8.2",
version="4.8.3",
terms_of_service=(
"http://robokop.renci.org:7055/tos"
"?service_long=Strider"
Expand Down Expand Up @@ -586,9 +586,15 @@ async def async_lookup(
LOGGER.info(
f"[{qid}] Posting async query response with {num_results} results to {callback}"
)
async with httpx.AsyncClient(timeout=httpx.Timeout(timeout=600.0)) as client:
res = await client.post(callback, json=query_results)
LOGGER.info(f"[{qid}] Posted to {callback} with code {res.status_code}")
try:
async with httpx.AsyncClient(
timeout=httpx.Timeout(timeout=600.0)
) as client:
res = await client.post(callback, json=query_results)
res.raise_for_status()
LOGGER.info(f"[{qid}] Posted to {callback} with code {res.status_code}")
except Exception as e:
LOGGER.error(f"[{qid}]: Callback to {callback} failed with: {e}")
except Exception as e:
LOGGER.error(e)

Expand Down Expand Up @@ -669,11 +675,11 @@ async def single_lookup(query_key):
@APP.post("/plan", response_model=dict[str, list[str]], include_in_schema=False)
async def generate_traversal_plan(
query: Query,
) -> list[list[str]]:
):
"""Generate plans for traversing knowledge providers."""
query_graph = query.message.query_graph.dict()
query_graph = query.message.query_graph

plan, _ = await generate_plan(query_graph)
plan, _ = await generate_plan(query_graph, backup_kps, LOGGER)

return plan

Expand Down
Loading