lablup / lablup/backend.ai

Add stop session API endpoints (REST + GraphQL)

Open
#9,813 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

Add REST and GraphQL API endpoints for stopping a session. Transitions session from RUNNING to STOPPING and triggers the sokovan scheduler.

REST:
- PATCH /sessions/{session_name}/stop (or similar)
- Validates session is in RUNNING state
- Sets session status to STOPPING
- Calls mark_scheduling_needed([ScheduleType.STOP])

GraphQL:
- stopSession mutation

Service layer:
- StopSessionAction + StopSessionActionResult
- stop_session() method in SessionService

Key files:
- manager/api/rest/session/handler.py (new stop handler)
- NEW: manager/services/session/actions/stop_session.py
- manager/services/session/service.py (stop_session method)
- NEW: manager/api/gql/session/resolver/stop.py
- manager/api/gql/schema.py (mutation registration)

## Success Criteria
- [ ] REST: stop running session → 204, session status becomes STOPPING
- [ ] REST: stop non-running session → 400/409 error
- [ ] GQL: stopSession mutation works equivalently
- [ ] Scheduler is notified via mark_scheduling_needed
- [ ] pants check passes for affected packages

JIRA Issue: BA-4962

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.