lablup / lablup/backend.ai

Add scoped deployment scheduling history REST v2 + SDK + CLI

Open
#11,739 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

## Goal

Expose `search_deployment_scoped_history` via REST v2 + SDK + CLI. The repository/service/processor layers and the GraphQL `deployment_scoped_scheduling_histories` query already exist; only the v2 stack from REST onward is missing.

## Scope

### REST v2
- Add `search_deployment_scoped_history` handler in `src/ai/backend/manager/api/rest/v2/scheduling_history/handler.py` (model after `admin_search_deployment_history` at L~60; take a deployment_id path param + filter/order/pagination)
- Register route in `src/ai/backend/manager/api/rest/v2/scheduling_history/registry.py`

### DTO
- Request/response under `src/ai/backend/common/dto/manager/v2/scheduling_history/`; reuse existing deployment-history filter/order types where possible

### Adapter
- Add `search_deployment_scoped_history` method in `src/ai/backend/manager/api/adapters/scheduling_history.py`

### SDK v2
- Add typed method in `src/ai/backend/client/v2/domains_v2/scheduling_history.py`

### CLI v2
- Add subcommand under `src/ai/backend/client/cli/v2/scheduling_history/` (e.g., `bai history deployment-scoped `)

## Success Criteria

### REST v2
- [ ] GET request with valid deployment_id and the caller has access → 200 with paginated history rows
- [ ] Request for a deployment the caller cannot access → 403
- [ ] Request for non-existent deployment_id → 404 (or empty list per existing convention)
- [ ] Filter / order / cursor params behave the same as the GraphQL equivalent

### SDK
- [ ] SDK method returns typed response; pagination iterator works end-to-end

### CLI
- [ ] `./bai history deployment-scoped ` prints rows; non-admin user can only see their own deployment
- [ ] Both admin and non-admin scenarios verified against live server

### General
- [ ] pants test passes for affected packages

JIRA Issue: BA-6141

Contributor guide

Open the contributing guide

Research direction

Start by reading admin_search_deployment_history in src/ai/backend/manager/api/rest/v2/scheduling_history/handler.py and the existing GraphQL deployment_scoped_scheduling_histories query. Trace the related registry, DTO, adapter, SDK, and CLI files named in the issue, then run affected pants tests. Done means the REST route, typed SDK pagination, and CLI command work for authorized, unauthorized, missing, admin, and non-admin cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.