Skip to content

Commit

Permalink
Add /spectrographs/fills/running endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Sep 17, 2024
1 parent 5b36bd9 commit f56e77e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/lvmapi/routers/spectrographs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from __future__ import annotations

import datetime
import pathlib
import re
import warnings

Expand Down Expand Up @@ -271,8 +272,18 @@ async def route_get_cryostats():
)


@router.get("/fills/running", summary="Is a fill currently running?")
async def route_get_fills_running() -> bool:
"""Returns whether an LN2 fill is currently running."""

return pathlib.Path("/data/lvmcryo.lock").exists()


@router.get("/fills/measurements", summary="Cryostat fill measurements")
async def route_get_fill_data(start_time: int, end_time: int) -> list[FillDataModel]:
async def route_get_fills_measurements(
start_time: int,
end_time: int,
) -> list[FillDataModel]:
"""Returns cryostat fill measurements."""

if start_time < 0 or end_time < 0 or start_time > end_time:
Expand All @@ -285,7 +296,7 @@ async def route_get_fill_data(start_time: int, end_time: int) -> list[FillDataMo


@router.post("/fills/register", summary="Register an LN2 fill")
async def route_post_register_fill(data: RegisterFillPostModel) -> int:
async def route_post_fills_register(data: RegisterFillPostModel) -> int:
"""Registers an LN2 fill."""

try:
Expand Down

0 comments on commit f56e77e

Please sign in to comment.