Abort one or more requests. To be used in a
Disaggregated Everything setup.
Source code in vllm/entrypoints/scale_out/token_in_token_out/api_router.py
| async def abort_requests(raw_request: Request):
"""Abort one or more requests. To be used in a
Disaggregated Everything setup.
"""
try:
body = await raw_request.json()
except json.JSONDecodeError as e:
raise HTTPException(
status_code=HTTPStatus.BAD_REQUEST.value,
detail=f"JSON decode error: {e}",
) from e
# Validate the parsed body instead of declaring it as a FastAPI body param:
# FastAPI's strict content-type check would then reject clients that send
# no `Content-Type`, which the legacy `/abort_requests` path still allows.
try:
request = AbortRequestsRequest.model_validate(body)
except ValidationError as e:
raise RequestValidationError(
errors=[{**err, "loc": ("body", *err["loc"])} for err in e.errors()]
) from e
# Abort requests in background
asyncio.create_task(engine_client(raw_request).abort(request.request_ids))
return Response(status_code=200)
|