tidy about functions
This commit is contained in:
@@ -48,6 +48,7 @@ from fastapi import status as api_status
|
||||
from fastapi.concurrency import run_in_threadpool
|
||||
from fastapi.security import OAuth2PasswordBearer
|
||||
from starlette.responses import StreamingResponse
|
||||
from uvicorn.workers import UvicornWorker # deprecated shim, present in pinned 0.34.2
|
||||
|
||||
from aare.daq import auth
|
||||
from aare.daq.config import BeamlineConfig
|
||||
@@ -81,6 +82,12 @@ _automation_progress_state: dict = {"seq": 0, "progress": None}
|
||||
_automation_progress_state_lock = asyncio.Lock()
|
||||
|
||||
|
||||
class AareUvicornWorker(UvicornWorker):
|
||||
# CONFIG_KWARGS merged last into uvicorn Config (uvicorn/workers.py:69) →
|
||||
# keeps our access-log filter + proxy_headers under gunicorn.
|
||||
CONFIG_KWARGS = {"log_config": get_uvicorn_logging_config(), "proxy_headers": False}
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(application: FastAPI):
|
||||
"""
|
||||
@@ -723,7 +730,7 @@ def initialise_detector(self):
|
||||
raise
|
||||
|
||||
|
||||
@app.get("/about/running_version")
|
||||
@app.get("/about/installed_version")
|
||||
async def running_version() -> str:
|
||||
return importlib.metadata.version("aare")
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
@@ -6,7 +8,7 @@ if TYPE_CHECKING:
|
||||
from aare.gui.threads.daq_worker import DAQWorker
|
||||
|
||||
|
||||
def about_text(client: DAQWorker):
|
||||
def about_text(client: "DAQWorker"):
|
||||
from aare.gui import gui
|
||||
|
||||
try:
|
||||
|
||||
@@ -357,7 +357,7 @@ class DAQWorker(QObject):
|
||||
reply.finished.connect(lambda: self.handle_status_response(reply))
|
||||
|
||||
def server_about_info(self) -> tuple[str, str]:
|
||||
version_request = QNetworkRequest(QUrl(f"{self.__base_url}/about/version"))
|
||||
version_request = QNetworkRequest(QUrl(f"{self.__base_url}/about/running_version"))
|
||||
version_reply = self.__net_manager.get(version_request)
|
||||
file_request = QNetworkRequest(QUrl(f"{self.__base_url}/about/server_file_path"))
|
||||
file_reply = self.__net_manager.get(file_request)
|
||||
|
||||
Reference in New Issue
Block a user