lablup / lablup/backend.ai

Increase session name length limit to match endpoint name constraints

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

## Problem

Currently, the `SessionRow.name` field has a 64-character length limit (`sa.String(length=64)`), while `EndpointRow.name` allows up to 512 characters (`sa.String(length=512)`).

When creating inference sessions for model service endpoints, the session name is generated based on the endpoint name. This causes API validation failures when endpoint names are longer than what the session name field can accommodate.

**Current constraints:**

- `SessionRow.name`: 64 characters (src/ai/backend/manager/models/session.py:676)
- `EndpointRow.name`: 512 characters (src/ai/backend/manager/models/endpoint.py:140)

## Proposed Solution

1. **Increase session name length limit to 512 characters**
- Modify `SessionRow.name` column to `sa.String(length=512)`
- Create Alembic migration to alter the column
1. **Adjust endpoint name validation**
- Account for session name suffix pattern (e.g., `-r{replica_number`}) when validating endpoint name length
- Ensure endpoint name + suffix does not exceed 512 characters
- Consider reserving ~10-20 characters for the suffix to allow reasonable replica numbering

## Acceptance Criteria

- [ ] Session name column supports up to 512 characters
- [ ] Database migration created and tested
- [ ] Endpoint creation API validates name length considering session name suffix
- [ ] Existing endpoints and sessions remain functional after migration
- [ ] Unit tests updated to cover new length limits

JIRA Issue: BA-3140

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.