lablup / lablup/backend.ai

Add REST API endpoints for active resource overview

Open
#9,730 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

Add REST API endpoints to query active resource overview per domain and project.

Reference pattern: api/rest/resource_slot/handler.py and api/rest/domain/handler.py

## Scope

### Endpoints
- GET /v8/domains/{domain_name}/resource-overview
- GET /v8/projects/{project_id}/resource-overview

### DTO (common/dto/manager/resource_slot/response.py)
- ActiveResourceOverviewResponse: BaseRootResponseModel
- slots: list of {slot_name: str, quantity: str (decimal string)}
- session_count: int

### Handler (api/rest/resource_slot/handler.py or api/rest/domain/handler.py)
- get_domain_resource_overview: PathParam[domain_name] -> ActiveResourceOverviewResponse
- get_project_resource_overview: PathParam[project_id] -> ActiveResourceOverviewResponse
- Calls Processor via info.context

### Registry
- Register new routes in appropriate registry.py

## Success Criteria
- [ ] GET /v8/domains/{domain_name}/resource-overview returns 200 with slot list and session_count
- [ ] GET /v8/projects/{project_id}/resource-overview returns 200 with slot list and session_count
- [ ] Returns empty slots and session_count=0 when no active sessions
- [ ] Non-existent domain/project returns appropriate error
- [ ] pants check passes for affected packages

JIRA Issue: BA-4917

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.