lablup / lablup/backend.ai

API: v2 REST + GraphQL + SDK for session allocatability check

Open
#12,312 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

Expose the allocatability check over the v2 API stack, delegating the decision to the scheduling controller.

## Scope
- Add v2 REST endpoint POST /v2/resource-allocation/check-allocatability (sibling of existing check_preset_availability).
- Add the matching GraphQL field; REST v2 and GraphQL share the adapter per project v2 rules.
- Request: scaling_group + requested_slots. Response: allocatable bool + per_agent[] (agent_id, available_slots, fits, insufficient[] ordered by rank descending).
- Wire Service/Action to delegate to SchedulingController.check_allocatability. API/handler layer must NOT make scheduling decisions.
- Add typed Client SDK v2 request/response (client/v2).
- Add throttling/rate-limit on the handler (UI-triggered, warning-only; must not become a load source).
- Depends on Story 1 (controller method + result type).

## Success Criteria
- [ ] REST: POST check-allocatability with fitting request -> 200, allocatable=true, per_agent populated
- [ ] REST: request that fits no node -> 200, allocatable=false, per_agent[].insufficient lists short slots ordered rank-desc
- [ ] GraphQL field returns the same shape as REST v2 (shared adapter)
- [ ] non-admin user can call it for their own scaling group; result identical to admin for same input
- [ ] throttling: rapid repeated calls are rate-limited (not unbounded)
- [ ] Client SDK v2 returns typed response object
- [ ] live-server verify passes for admin and non-admin
- [ ] pants test passes for affected packages

JIRA Issue: BA-6564

Contributor guide

Open the contributing guide

Research direction

Start with Story 1 and the existing check_preset_availability endpoint, then trace the v2 Service/Action, shared REST/GraphQL adapter, handler, and SchedulingController.check_allocatability entry points. Review client/v2 for the typed SDK pattern and run affected pants tests before live-server verification. Done means the REST and GraphQL shapes match, permissions and throttling work, and both admin and non-admin checks pass.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.