Skip to content

Commit

Permalink
Add support for CDM v8
Browse files Browse the repository at this point in the history
Principally this changes the names of the various document "id" fields from
"id" to "<doctype>-uuid" (e.g., "run-uuid"). This code determines whether the
Crucible instance is using v7 or v8, and generates the proper ID field names.

There are some other minor cleanups here, in handling broken documents.
  • Loading branch information
dbutenhof committed Dec 13, 2024
1 parent 0c67237 commit 0039473
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 82 deletions.
10 changes: 7 additions & 3 deletions backend/app/api/v1/endpoints/ilab/ilab.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
from datetime import datetime, timedelta, timezone
from typing import Annotated, Any, Optional

from fastapi import APIRouter, Depends, Query

from app.services.crucible_svc import CrucibleService, GraphList, Metric
from fastapi import APIRouter, Depends, Query

router = APIRouter()

Expand All @@ -30,6 +29,7 @@ async def crucible_svc():
crucible = None
try:
crucible = CrucibleService(CONFIGPATH)
await crucible.detect_cdm()
yield crucible
finally:
if crucible:
Expand Down Expand Up @@ -143,6 +143,7 @@ async def runs(
Optional[str],
Query(description="End time for search", examples=["2020-11-10"]),
] = None,
undated: Annotated[bool, Query(description="Don't filter on dates")] = False,
filter: Annotated[
Optional[list[str]],
Query(
Expand All @@ -161,7 +162,10 @@ async def runs(
Query(description="Page offset to start", examples=[10]),
] = 0,
):
if start_date is None and end_date is None:
if undated:
start = None
end = None
elif start_date is None and end_date is None:
now = datetime.now(timezone.utc)
start = now - timedelta(days=30)
end = now
Expand Down
2 changes: 0 additions & 2 deletions backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ def render(self, content: typing.Any) -> bytes:

@app.middleware('http')
async def some_middleware(request: Request, call_next):
print(f"origin: {origins}, request: {request.headers}")
print(f"{request.app.user_middleware}")
if request.url.path in routes_to_reroute:
request.scope['path'] = '/docs'
headers = dict(request.scope['headers'])
Expand Down
Loading

0 comments on commit 0039473

Please sign in to comment.