Skip to content

Commit

Permalink
logging improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
northdpole committed Jan 14, 2024
1 parent 87c6fec commit 62d9375
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 0 additions & 2 deletions application/database/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ class Node(BaseModel): # type: ignore
name,
section,
subsection,
ntype,
description,
version,
section_id,
name="uq_node",
Expand Down
4 changes: 2 additions & 2 deletions application/prompt_client/prompt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def instance(cls, database: db.Node_collection, ai_client: Any):
cls.__playwright = sync_playwright().start()
nltk.download("punkt")
nltk.download("stopwords")
cls.__webkit = cls.__playwright.webkit
cls.__firefox = cls.__playwright.firefox
cls.__browser = (
cls.__webkit.launch()
cls.__firefox.launch()
) # headless=False, slow_mo=1000)
cls.__context = cls.__browser.new_context()

Expand Down
10 changes: 7 additions & 3 deletions application/utils/gap_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,22 @@ def preload(target_url: str):
res1 = requests.get(
f"{target_url}/rest/v1/map_analysis?standard={sa}&standard={sb}"
)
if res1.json():
if res1.status_code != 200:
print(f"{sa}->{sb} returned {res1.status_code}")
elif res1.json():
if res1.json().get("result"):
if f"{sa}->{sb}" in waiting:
waiting.remove(f"{sa}->{sb}")
res2 = requests.get(
f"{target_url}/rest/v1/map_analysis?standard={sb}&standard={sa}"
)
if res2.json():
if res2.status_code != 200:
print(f"{sb}->{sa} returned {res1.status_code}")
elif res2.json():
if res2.json().get("result"):
if f"{sb}->{sa}" in waiting:
waiting.remove(f"{sb}->{sa}")
print(f"calculating {len(waiting)} gap analyses")
print(waiting)
# print(waiting)
time.sleep(30)
print("map analysis preloaded successfully")
1 change: 1 addition & 0 deletions application/web/web_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def gap_analysis() -> Any:
try:
res = job.Job.fetch(id=gap_analysis_dict.get("job_id"), connection=conn)
except exceptions.NoSuchJobError as nje:
logger.error(f"Could not find job id for gap analysis {standards}")
abort(404, "No such job")
if (
res.get_status() != job.JobStatus.FAILED
Expand Down

0 comments on commit 62d9375

Please sign in to comment.