From 85bfb0cb3097d7058866ffa060fbea460a8459d2 Mon Sep 17 00:00:00 2001 From: "spaceBearAmadeus (Alex)" Date: Tue, 22 Oct 2024 13:49:22 -0400 Subject: [PATCH] updates --- assets/scripts/build_all.sh | 10 ++++-- compose_api/main.py | 4 +-- compose_api/spec/openapi_3_1_0_generated.yaml | 34 ++++++++++++++++--- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/assets/scripts/build_all.sh b/assets/scripts/build_all.sh index 8290bd051..3bfe44f65 100755 --- a/assets/scripts/build_all.sh +++ b/assets/scripts/build_all.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash -set -e - arg1="$1" +arg2="$2" # optionally prune/clear system and cache prior to build if [ "$arg1" == "-p" ]; then @@ -10,6 +9,10 @@ if [ "$arg1" == "-p" ]; then yes | docker buildx prune -a fi +# remove old spec, create new +sudo rm compose_api/spec/openapi_3_1_0_generated.yaml +cd compose_api && python3 openapi_spec.py && cd .. + # remove pycache to clean images sudo rm -r compose_api/__pycache__ sudo rm -r compose_worker/__pycache__ @@ -17,3 +20,6 @@ sudo rm -r compose_worker/__pycache__ # build and push containers docker compose build --no-cache +if [ "$arg2" == "-r" ]; then + docker compose up +fi diff --git a/compose_api/main.py b/compose_api/main.py index 965108e92..676f1ac48 100644 --- a/compose_api/main.py +++ b/compose_api/main.py @@ -2,7 +2,6 @@ import os import logging import uuid -from enum import Enum from typing import * import dotenv @@ -13,12 +12,11 @@ from fastapi.responses import FileResponse from pydantic import BeforeValidator, Field, BaseModel from starlette.middleware.cors import CORSMiddleware -from sympy.multipledispatch.dispatcher import source from compatible import COMPATIBLE_VERIFICATION_SIMULATORS -from compose_api.data_model import ObservableData # from bio_check import MONGO_URI from data_model import ( + ObservableData, SimulatorRMSE, SmoldynJob, VerificationOutput, diff --git a/compose_api/spec/openapi_3_1_0_generated.yaml b/compose_api/spec/openapi_3_1_0_generated.yaml index 2b5841f1a..1bd3ce675 100644 --- a/compose_api/spec/openapi_3_1_0_generated.yaml +++ b/compose_api/spec/openapi_3_1_0_generated.yaml @@ -703,9 +703,9 @@ components: title: HTTPValidationError ObservableData: properties: - name: + observable_name: type: string - title: Name + title: Observable Name mse: type: object title: Mse @@ -713,11 +713,17 @@ components: type: object title: Proximity output_data: + additionalProperties: + anyOf: + - items: + type: number + type: array + - type: string type: object title: Output Data type: object required: - - name + - observable_name - mse - proximity - output_data @@ -858,6 +864,21 @@ components: required: - name title: Simulator + SimulatorRMSE: + properties: + simulator: + type: string + title: Simulator + rmse_matrix: + additionalProperties: + type: number + type: object + title: Rmse Matrix + type: object + required: + - simulator + - rmse_matrix + title: SimulatorRMSE SmoldynRun: properties: job_id: @@ -942,10 +963,13 @@ components: title: Requested Simulators results: anyOf: - - type: object - items: - $ref: '#/components/schemas/ObservableData' + anyOf: + - $ref: '#/components/schemas/ObservableData' + - $ref: '#/components/schemas/SimulatorRMSE' + - {} type: array + - type: object - type: 'null' title: Results type: object