Prepare State Hub retirement baseline
This commit is contained in:
parent
2217bdd9f5
commit
5927591be8
46 changed files with 32583 additions and 62 deletions
13
api/routers/ops_runs.py
Normal file
13
api/routers/ops_runs.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from fastapi import APIRouter
|
||||
|
||||
from api.schemas.ops_run import OpsRunProjection
|
||||
from api.services.ops_run_projection import get_ops_run_projection
|
||||
|
||||
|
||||
router = APIRouter(prefix="/ops-runs", tags=["ops-runs"])
|
||||
|
||||
|
||||
@router.get("/summary", response_model=OpsRunProjection)
|
||||
async def get_ops_runs_summary(refresh: bool = False) -> OpsRunProjection:
|
||||
"""Project activity-core queue health; State Hub never claims ops runs."""
|
||||
return await get_ops_run_projection(refresh=refresh)
|
||||
|
|
@ -53,6 +53,7 @@ from api.services.summary_cache import (
|
|||
get_summary_cache,
|
||||
register_summary_cache_invalidation,
|
||||
)
|
||||
from api.services.ops_run_projection import get_ops_run_projection
|
||||
|
||||
|
||||
def _dual_workplan_refs(
|
||||
|
|
@ -111,22 +112,22 @@ async def get_summary(
|
|||
|
||||
if cache_status == "hit-revision" and cached is not None:
|
||||
_summary_cache_headers(response, cache_status="hit-revision", revision=revision_token)
|
||||
return cached
|
||||
return cached.model_copy(update={"ops_runs": await get_ops_run_projection()})
|
||||
|
||||
if cache_status == "progress-section" and cached is not None:
|
||||
result = await apply_progress_section(session, cached, revision)
|
||||
_summary_cache_headers(response, cache_status="hit-revision", revision=revision_token)
|
||||
return result
|
||||
return result.model_copy(update={"ops_runs": await get_ops_run_projection()})
|
||||
|
||||
if cache_status == "stale" and cached is not None:
|
||||
cache.schedule_refresh(revision)
|
||||
_summary_cache_headers(response, cache_status="stale", revision=revision_token)
|
||||
return cached
|
||||
return cached.model_copy(update={"ops_runs": await get_ops_run_projection()})
|
||||
|
||||
result = await build_state_summary(session)
|
||||
cache.store(result, revision)
|
||||
_summary_cache_headers(response, cache_status="miss", revision=revision_token)
|
||||
return result
|
||||
return result.model_copy(update={"ops_runs": await get_ops_run_projection(refresh=force_refresh)})
|
||||
|
||||
|
||||
async def build_state_summary(session: AsyncSession) -> StateSummary:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue