-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Description
Wire the data models #837 and caching infrastructure #838 together: implement ResourceStatusSource(CacheableSource) that reads from ResourceStatusDB and serves resource status through a new config route.
Scope
-
ResourceStatusSource: aCacheableSourcesubclass that:- Reads from
ResourceStatusDB(Site + Resource status tables) - Translates DB status values (
Active/Degraded/Banned/...) to the binary Pydantic models (AllowedStatus/BannedStatus) - Implements
latest_revision()— e.g. hash of current status snapshot, or maxDateEffective/LastCheckTime - Implements
read_raw()— returns the full status dict per resource type and VO
- Reads from
-
Route: new endpoint under the config router:
/config/resource-status/storage?vo={inferred_from_credentials} -> dict[str, StorageElementStatus]Equivalent endpoints for compute and site status.
-
Access policy: any authenticated user can read (similar to current config endpoint being
@open_access, but scoped to the user's VO). -
Integration tests: verify end-to-end flow from DB data to API response, including HTTP caching headers (ETag / 304 Not Modified).
Technical details
ResourceStatusSourcelives indiracx-core/src/diracx/core/config/or a newdiracx-core/src/diracx/core/rss/package- VO is inferred from the client's token — no need to expose all VOs
- HTTP caching (ETag, Last-Modified, 304) should reuse the same pattern as the config endpoint
- Dependency injection:
ResourceStatusSourceneeds access toResourceStatusDB— design the wiring so it fits the existing DI patterns
Reference
- Chris's route proposal: #790 comment
- Config router pattern:
diracx-routers/src/diracx/routers/configuration.py - DI patterns:
diracx-routers/src/diracx/routers/dependencies.py
Acceptance criteria
-
ResourceStatusSource(CacheableSource)reads fromResourceStatusDBand produces Pydantic status models - Route serves storage/compute/site status per VO
- HTTP caching headers (ETag, 304 Not Modified)
- Access policy: authenticated users, scoped to their VO
- Integration tests covering the full read path
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels