Skip to content

Commit

Permalink
removing 1.4 from the endpoint URLs and references to TRAPI 1.4 that …
Browse files Browse the repository at this point in the history
…aren't necessary
  • Loading branch information
EvanDietzMorris committed Apr 12, 2024
1 parent f15aca2 commit 1fe8d36
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion PLATER/plater-clustered-docker/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function heartbeat {
echo "starting heartbeat logic... "
if [[ ! -z "${AUTOMAT_HOST}" ]]; then
echo "Checking Plater status..."
testEndpoint=${PLATER_SERVICE_ADDRESS}:${WEB_PORT}/1.4/meta_knowledge_graph
testEndpoint=${PLATER_SERVICE_ADDRESS}:${WEB_PORT}/meta_knowledge_graph
response=$(curl --write-out %{http_code} --silent --output /dev/null ${testEndpoint})
until [ $response = "200" ]; do
response=$(curl --write-out %{http_code} --silent --output /dev/null ${testEndpoint})
Expand Down
14 changes: 7 additions & 7 deletions PLATER/services/app_trapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
config.get('logging_format'),
)

# Mount open api at /1.4/openapi.json
APP_TRAPI_1_4 = FastAPI(openapi_url="/openapi.json", docs_url="/docs", root_path='/1.4')
# Mount open api at /openapi.json
APP_TRAPI = FastAPI(openapi_url="/openapi.json", docs_url="/docs", root_path='/')


def get_meta_kg_response(graph_metadata_reader: GraphMetadata):
Expand Down Expand Up @@ -131,7 +131,7 @@ async def reasoner_api(
return json_response


APP_TRAPI_1_4.add_api_route(
APP_TRAPI.add_api_route(
"/meta_knowledge_graph",
get_meta_knowledge_graph,
methods=["GET"],
Expand All @@ -142,7 +142,7 @@ async def reasoner_api(
tags=["trapi"]
)

APP_TRAPI_1_4.add_api_route(
APP_TRAPI.add_api_route(
"/sri_testing_data",
get_sri_testing_data,
methods=["GET"],
Expand All @@ -153,7 +153,7 @@ async def reasoner_api(
tags=["trapi"]
)

APP_TRAPI_1_4.add_api_route(
APP_TRAPI.add_api_route(
"/query",
reasoner_api,
methods=["POST"],
Expand All @@ -164,15 +164,15 @@ async def reasoner_api(
tags=["trapi"]
)

APP_TRAPI_1_4.openapi_schema = construct_open_api_schema(app=APP_TRAPI_1_4, trapi_version="1.4.0", prefix='/1.4')
APP_TRAPI.openapi_schema = construct_open_api_schema(app=APP_TRAPI, trapi_version="1.5.0")

# env var PROFILE_EVERYTHING=true could be used to turn on profiling / speedscope results for all http endpoints
if config.get('PROFILER_ON', False) and (config.get('PROFILER_ON') not in ("false", "False")):
from pyinstrument import Profiler
from pyinstrument.renderers import SpeedscopeRenderer
from fastapi.responses import HTMLResponse

@APP_TRAPI_1_4.middleware("http")
@APP_TRAPI.middleware("http")
async def profile_request(request: Request, call_next):
profiling = request.query_params.get("profile", "false")
if profiling and profiling != "false":
Expand Down
10 changes: 5 additions & 5 deletions PLATER/services/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from PLATER.services.config import config
from PLATER.services.util.logutil import LoggingUtil
from PLATER.services.app_common import APP_COMMON
from PLATER.services.app_trapi import APP_TRAPI_1_4
from PLATER.services.app_trapi import APP_TRAPI
from PLATER.services.util.api_utils import construct_open_api_schema

TITLE = config.get('PLATER_TITLE', 'Plater API')

VERSION = os.environ.get('PLATER_VERSION', '1.4.0-2')
VERSION = os.environ.get('PLATER_VERSION', '1.6.0')

logger = LoggingUtil.init_logging(
__name__,
Expand All @@ -21,13 +21,13 @@

APP = FastAPI()

# Mount 1.4 app at /1.4
APP.mount('/1.4', APP_TRAPI_1_4, 'Trapi 1.4')
# Mount TRAPI app at /
APP.mount('/', APP_TRAPI, 'TRAPI')
# Mount default app at /
APP.mount('/', APP_COMMON, '')
# Add all routes of each app for open api generation at /openapi.json
# This will create an aggregate openapi spec.
APP.include_router(APP_TRAPI_1_4.router, prefix='/1.4')
APP.include_router(APP_TRAPI.router)
APP.include_router(APP_COMMON.router)
# Construct app /openapi.json # Note this is not to be registered on smart api . Instead /1.1/openapi.json
# or /1.2/openapi.json should be used.
Expand Down
2 changes: 1 addition & 1 deletion PLATER/services/util/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_bl_helper():

def construct_open_api_schema(app, trapi_version, prefix=""):
plater_title = config.get('PLATER_TITLE', 'Plater API')
plater_version = os.environ.get('PLATER_VERSION', '1.4.0-2')
plater_version = os.environ.get('PLATER_VERSION', '1.6.0')
server_url = os.environ.get('PUBLIC_URL', '')
if app.openapi_schema:
return app.openapi_schema
Expand Down

0 comments on commit 1fe8d36

Please sign in to comment.