lablup / lablup/backend.ai

Redesign Creator pattern for repository operations

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

## Overview

Redesign the `Creator` pattern used in repository operations for better consistency and type safety.

## Background

Current `Creator` classes (e.g., `SessionSchedulingHistoryCreator`, `DeploymentHistoryCreator`) have some inconsistencies:

- `fields_to_store()` method returns `dict[str, Any]` which loses type information
- Serialization logic (e.g., Pydantic model_dump) is embedded in Creator
- No clear separation between input validation and storage transformation

## Goals

- Improve type safety in Creator pattern
- Standardize serialization approach across all Creator classes
- Consider alignment with Querier/Purger patterns for consistency

## Scope

Affected Creator classes:

- `SessionSchedulingHistoryCreator`
- `KernelSchedulingHistoryCreator`
- `DeploymentHistoryCreator`
- `RouteHistoryCreator`
- Other existing Creator classes in the codebase

## Parent Epic

BA-3060

JIRA Issue: BA-3338

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.