Skip to content

Commit

Permalink
updates to api and worker specs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Jul 31, 2024
1 parent 7991f9b commit 2e0ec33
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/.CONTAINER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.2
1.0.3
28 changes: 17 additions & 11 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from starlette.middleware.cors import CORSMiddleware

# from bio_check import MONGO_URI
from data_model import DbClientResponse, UtcComparisonResult, OmexComparisonSubmission, SbmlComparisonSubmission
from data_model import DbClientResponse, UtcComparisonResult, PendingOmexJob, PendingSbmlJob
from shared import save_uploaded_file, upload_blob, MongoDbConnector
from log_config import setup_logging

Expand Down Expand Up @@ -111,7 +111,7 @@ def root():

@app.post(
"/verify-omex", # "/biosimulators-utc-comparison",
response_model=OmexComparisonSubmission,
response_model=PendingOmexJob,
name="Uniform Time Course Comparison from OMEX/COMBINE archive",
operation_id="verify-omex",
summary="Compare UTC outputs from a deterministic SBML model within an OMEX/COMBINE archive.")
Expand All @@ -124,10 +124,14 @@ async def verify_omex(
truth: UploadFile = File(default=None, description="reports.h5 file defining the 'ground-truth' to be included in the comparison."),
rTol: Optional[float] = Query(default=None, description="Relative tolerance to use for proximity comparison."),
aTol: Optional[float] = Query(default=None, description="Absolute tolerance to use for proximity comparison.")
) -> OmexComparisonSubmission:
) -> PendingOmexJob:
try:
# request specific params
compare_id = comparison_id or "utc_comparison"
if comparison_id is None:
compare_id = "utc_comparison_omex"
else:
compare_id = comparison_id

job_id = compare_id + "_" + str(uuid.uuid4())
_time = db_connector.timestamp()

Expand Down Expand Up @@ -159,7 +163,6 @@ async def verify_omex(
job_id=job_id,
path=uploaded_file_location,
simulators=simulators,
comparison_id=compare_id,
timestamp=_time,
ground_truth_report_path=report_location,
include_outputs=include_outputs,
Expand All @@ -173,14 +176,14 @@ async def verify_omex(
if report_fp:
os.remove(report_fp)

return OmexComparisonSubmission(**pending_job_doc)
return PendingOmexJob(**pending_job_doc)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))


@app.post(
"/verify-sbml",
response_model=SbmlComparisonSubmission,
response_model=PendingSbmlJob,
name="Uniform Time Course Comparison from SBML file",
operation_id="verify-sbml",
summary="Compare UTC outputs from a deterministic SBML model.")
Expand All @@ -194,10 +197,14 @@ async def verify_sbml(
rTol: Optional[float] = Query(default=None, description="Relative tolerance to use for proximity comparison."),
aTol: Optional[float] = Query(default=None, description="Absolute tolerance to use for proximity comparison."),
selection_list: Optional[List[str]] = Query(default=None, description="List of observables to include in the return data."),
) -> SbmlComparisonSubmission:
) -> PendingSbmlJob:
try:
# request specific params
compare_id = comparison_id or "utc_comparison"
if comparison_id is None:
compare_id = "utc_comparison_omex"
else:
compare_id = comparison_id

job_id = compare_id + "_" + str(uuid.uuid4())
_time = db_connector.timestamp()

Expand All @@ -220,7 +227,6 @@ async def verify_sbml(
job_id=job_id,
path=uploaded_file_location,
simulators=simulators,
comparison_id=compare_id,
timestamp=_time,
duration=duration,
n_steps=number_of_steps,
Expand All @@ -233,7 +239,7 @@ async def verify_sbml(
# clean up local temp files
os.remove(fp)

return SbmlComparisonSubmission(**pending_job_doc)
return PendingSbmlJob(**pending_job_doc)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

Expand Down
12 changes: 6 additions & 6 deletions api/spec/openapi_3_1_0_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/OmexComparisonSubmission'
$ref: '#/components/schemas/PendingOmexJob'
'422':
description: Validation Error
content:
Expand Down Expand Up @@ -204,7 +204,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/SbmlComparisonSubmission'
$ref: '#/components/schemas/PendingSbmlJob'
'422':
description: Validation Error
content:
Expand Down Expand Up @@ -274,7 +274,7 @@ components:
title: Detail
type: object
title: HTTPValidationError
OmexComparisonSubmission:
PendingOmexJob:
properties:
job_id:
type: string
Expand Down Expand Up @@ -333,8 +333,8 @@ components:
- timestamp
- path
- simulators
title: OmexComparisonSubmission
SbmlComparisonSubmission:
title: PendingOmexJob
PendingSbmlJob:
properties:
job_id:
type: string
Expand Down Expand Up @@ -396,7 +396,7 @@ components:
- duration
- n_steps
- simulators
title: SbmlComparisonSubmission
title: PendingSbmlJob
UtcComparisonResult:
properties:
content:
Expand Down
2 changes: 1 addition & 1 deletion kustomize/overlays/biochecknet/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace: biochecknet

images:
- name: ghcr.io/biosimulators/bio-check-api
newTag: 1.0.2
newTag: 1.0.3
- name: ghcr.io/biosimulators/bio-check-worker
newTag: 1.0.0
- name: mongo
Expand Down

0 comments on commit 2e0ec33

Please sign in to comment.