lablup / lablup/backend.ai

Add the lifecycle controller and coordinator, and apply them to domain

Open
#13,913 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
21h 49m
Merged PRs (30d)
404

Description

BEP-1069 §3.3, §3.4. 삭제 lifecycle 의 컨트롤러·코디네이터·cleanup stage 계약을 만들고 domain 에 먼저 적용한다.

### 실제 구현은 단일 status enum 이다 (BEP 와 다름)

BEP §3.1 은 존재축과 작업축 두 컬럼을 전제하나, BA-7451 은 entity 마다 status enum 하나로 구현했다. 정리 진행을 purging / purge-error 값으로 같은 enum 에 얹었다. 컨트롤러는 그 값을 옮기는 것으로 정리 시작·실패를 표현한다.

| entity | 정리 중 | 정리 실패 |
|---|---|---|
| domain, project | purging | purge-error |
| user | purging | purge-error |
| image | PURGING | PURGE_ERROR |
| vfolder | delete-ongoing (기존) | delete-error (기존) |

### 왜 domain 이 먼저인가

stage 목록이 가장 짧다. domain 은 하위 entity 를 직접 지우지 않고 \***project 와 user 의 purge 를 트리거한 뒤 완료를 기다리면 된다.**\* 그 둘이 각자 자기 하위 자원을 정리한다.

### 할 일

- 컨트롤러 - 요청을 받아 status 를 purging 으로 옮기고 정리를 시작시킨다.
- 코디네이터 - stage 를 순서대로 돌리고 결과를 판정한다. 재시도가 소진되면 purge-error 로 옮긴다.
- cleanup stage 계약 - 한 stage 가 무엇을 받고 무엇을 답하는지.
- 레지스트리 sweep 테스트 - 다섯 entity 가 각자 핸들러를 등록했는지 확인한다.
- domain 핸들러 - 하위 project·user 의 purge 트리거 + 완료 대기.

### BA-7453 이 남긴 27줄을 여기서 흡수한다

BA-7453 (제네릭 reconciler base 를 manager/reconciler 로 이동) 은 Not Planned 가 됐다. sokovan 을 틱 기반 entity lifecycle 전반으로 넓히는 방향이라 base 가 sokovan 에 남기 때문이다. 이동을 뺐을 때 남는 두 가지를 이 이슈가 가져간다 (2 파일 27 줄).

- sokovan/reconciler/base.py 의 계약에서 data/session/options.HandlerPolicyResolver 를 끊고, 재시도 예산과 단계 타임아웃만 요구하는 ReconcilePolicy / ReconcilePolicyResolver 를 base 에 둔다. 기존 구현 3곳(idle_check, deployment group lifecycle, deployment group scaling)은 구조적으로 만족해 수정이 없다.
- base 와 coordinator 의 docstring 에서 스케줄링 어휘를 제거한다.

SchedulingResult 개명은 하지 않는다. 값 자체에 스케줄링 의미가 없어 삭제 lifecycle 이 그대로 쓸 수 있고, 34 파일 치환 비용을 지금 낼 이유가 없다.

이 작업이 자기 정책 타입을 들고 오므로 인터페이스 모양이 그 자리에서 검증된다.

### 의존

BA-7451 (status enum 추가) 머지됨. 막는 것 없음.

JIRA Issue: BA-7454

Contributor guide

Open the contributing guide

Research direction

Start with BEP-1069 sections 3.3 and 3.4, then inspect sokovan/reconciler/base.py and the existing lifecycle implementations. Define the controller, coordinator, cleanup-stage contract, and registry sweep test for the five entities, with domain waiting for project and user purge completion. Done means retries and timeouts lead to the documented status transitions and the registry test verifies every handler is registered.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.