lablup / lablup/backend.ai

Clarify the input handling of session template CRUD API

Open
#3,239 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

In lablup/backend.ai-manager#480, #1406, and #1668, the session template creation API became able to process only the `yaml.safe_load_all()`'s return value, which is a generator.

https://github.com/lablup/backend.ai/blob/396853884d7bb591f3e4cf21ce29e41da3ed9c75/src/ai/backend/manager/api/session_template.py#L57-L65

In L64, it may crash with the `json.loads()` output as it would just return a dict, when the client submits a JSON data instead of YAML data. This is a potential bug.

Along with #3183, we need to clarify whether:

- the API handler decomposes the input parameter object and applies individual validation to its parts, or
- delegates the entire parameter interpretation to a structured schema (e.g., Pydantic).
The template schema itself should also allow _unspecified value_ for the `architecture` field to support reusing the same template with multi-arch images in different host architectures (e.g., DGX-H100 and GH200 nodes).

cf) Currently the manager accepts as `payload` of the session template creation API:

```yaml
template:
api_version: 1 # actually ignored
type: "taskTemplate"
spec:
kernel:
...
```

JIRA Issue: BA-11

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.