Frontend: better error message handling for FINISH_ABORT in scheduler.py (#2956)

This commit is contained in:
Chang Su
2025-01-18 19:37:30 -08:00
committed by GitHub
parent 2bd18e2d76
commit 4d4cdb3fe7
5 changed files with 50 additions and 31 deletions

View File

@@ -1,4 +1,5 @@
import logging
from http import HTTPStatus
from typing import Optional
from sglang.srt.managers.schedule_batch import FINISH_ABORT, Req
@@ -35,7 +36,9 @@ def validate_input_length(
f"Use a shorter input or enable --allow-auto-truncate."
)
logger.error(error_msg)
req.finished_reason = FINISH_ABORT(error_msg)
req.finished_reason = FINISH_ABORT(
error_msg, HTTPStatus.BAD_REQUEST, "BadRequestError"
)
return error_msg
return None