lablup / lablup/backend.ai

[Sokovan] Sprint 4: Cleaner Extraction

Open
#6,895 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

## Objective

Extract termination and cleanup logic (TERMINATING → TERMINATED) into the Cleaner engine.

## Tasks

### 1. Create Cleaner Package Structure

```
scheduler/cleaner/
├── __init__.py
└── handler.py
```

### 2. Implement Cleaner Handler

- Extend base Handler class
- Handle session termination
- Handle orphan session sweeping
- Define `target_statuses()` = [TERMINATING]
- Define `next_status()` = TERMINATED
- Define `failure_status()` = None (always succeeds eventually)

### 3. Extract Logic from scheduler.py

Key methods to extract:

- `terminate_sessions()`
- `_terminate_single_session()`
- `sweep_sessions()`
- Resource cleanup logic
- Agent communication for kernel destruction

### 4. Integration

- Register Cleaner handler with Coordinator
- Handle graceful vs forced termination
- Ensure resource deallocation

## Acceptance Criteria

- [ ] Cleaner package structure created
- [ ] Handler implementation complete
- [ ] All termination/cleanup logic extracted
- [ ] Resource deallocation verified
- [ ] Integration tests pass

JIRA Issue: BA-3124

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.