lablup / lablup/backend.ai

Update App Proxy API handlers to use Repository

Open
#7,068 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

Replace DB session usage with Repository calls in API handlers

## Files to Modify

- `src/ai/backend/appproxy/coordinator/api/worker_v1.py`
- `src/ai/backend/appproxy/coordinator/api/worker_v2.py`
- `src/ai/backend/appproxy/coordinator/api/circuit_v1.py`
- `src/ai/backend/appproxy/coordinator/api/circuit_v2.py`
- `src/ai/backend/appproxy/coordinator/api/endpoint.py`
- `src/ai/backend/appproxy/coordinator/api/slot_v1.py`
- `src/ai/backend/appproxy/coordinator/api/slot_v2.py`
- `src/ai/backend/appproxy/coordinator/api/proxy.py`
- `src/ai/backend/appproxy/coordinator/api/health.py`

## Change Pattern

```python
# Before
async with root_ctx.db.begin_readonly_session() as sess:
worker = await Worker.get(sess, worker_id)

# After
worker = await root_ctx.worker_repository.get(worker_id)
```

JIRA Issue: BA-3224

Contributor guide

Open the contributing guide

Research direction

Start by reading the nine listed API handler modules, beginning with worker_v1.py and worker_v2.py, and compare their DB-session accesses with the repository change pattern in the issue. Update every named file so its handlers use the appropriate root_ctx repository calls, then verify that no listed handler still uses the old session-based access pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.