argus/src/master/app/routes.py
yuyr 1e5e91b193 dev_1.0.0_yuyr_2:重新提交 PR,增加 master/agent 以及系统集成测试 (#17)
Reviewed-on: #17
Reviewed-by: sundapeng <sundp@mail.zgclab.edu.cn>
Reviewed-by: xuxt <xuxt@zgclab.edu.cn>
2025-10-11 15:04:46 +08:00

25 lines
801 B
Python

from __future__ import annotations
from flask import Flask, jsonify
from .config import AppConfig
from .nodes_api import create_nodes_blueprint
from .scheduler import StatusScheduler
from .storage import Storage
def register_routes(app: Flask, storage: Storage, scheduler: StatusScheduler, config: AppConfig) -> None:
app.register_blueprint(create_nodes_blueprint(storage, scheduler), url_prefix="/api/v1/master")
@app.get("/healthz")
def healthz():
return jsonify({"status": "ok"})
@app.get("/readyz")
def readyz():
try:
storage.list_nodes() # simple readiness probe
except Exception as exc: # pragma: no cover - defensive
return jsonify({"status": "error", "error": str(exc)}), 500
return jsonify({"status": "ok"})