Skip to content

Commit

Permalink
Add mount for exp_checker subapp
Browse files Browse the repository at this point in the history
  • Loading branch information
ugyballoons committed Oct 30, 2024
1 parent a6764e8 commit a87c48a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions python/lsst/ts/exp_checker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this directory will be overwritten by the actual exp-checker app:
# https://github.com/lsst-sitcom/rubin_exp_checker

from .helloworld import app
11 changes: 11 additions & 0 deletions python/lsst/ts/exp_checker/helloworld.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# this directory will be overwritten by the actual exp-checker app:
# https://github.com/lsst-sitcom/rubin_exp_checker

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_sub() -> dict[str, str]:
return {"message": "Hello World!"}
15 changes: 14 additions & 1 deletion python/lsst/ts/rubintv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from . import __version__
from .background.currentpoller import CurrentPoller
from .background.historicaldata import HistoricalPoller
from .config import config
from .config import config, rubintv_logger
from .handlers.api import api_router
from .handlers.ddv_routes_handler import ddv_router
from .handlers.ddv_websocket_handler import ddv_client_ws_router, internal_ws_router
Expand All @@ -33,6 +33,16 @@
from .models.models_init import ModelsInitiator
from .s3client import S3Client

logger = rubintv_logger()

exp_checker_installed = False
try:
from ..exp_checker import app as exp_checker_app

exp_checker_installed = True
except ModuleNotFoundError:
logger.warn("exp-checker not found. Not mounting.")

__all__ = ["app", "config"]


Expand Down Expand Up @@ -80,6 +90,9 @@ def create_app() -> FastAPI:
lifespan=lifespan,
)

if exp_checker_installed:
app.mount(f"{config.path_prefix}/exp_checker", exp_checker_app)

# Intwine webpack assets
# generated with npm run build
if os.path.isdir("assets"):
Expand Down

0 comments on commit a87c48a

Please sign in to comment.