Skip to content

Commit

Permalink
chore: Revert response type of service create API (#1979)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa authored Mar 31, 2024
1 parent 25c8aaf commit 4a0fb50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions changes/1979.misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Revert response type of service create API.
14 changes: 11 additions & 3 deletions src/ai/backend/manager/api/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ async def _validate(request: web.Request, params: NewServiceRequestModel) -> Val
@auth_required
@server_status_required(ALL_ALLOWED)
@pydantic_params_api_handler(NewServiceRequestModel)
async def create(request: web.Request, params: NewServiceRequestModel) -> SuccessResponseModel:
async def create(request: web.Request, params: NewServiceRequestModel) -> ServeInfoModel:
"""
Creates a new model service. If `desired_session_count` is greater than zero,
then inference sessions will be automatically scheduled upon successful creation of model service.
Expand Down Expand Up @@ -587,9 +587,17 @@ async def create(request: web.Request, params: NewServiceRequestModel) -> Succes
open_to_public=params.open_to_public,
)
db_sess.add(endpoint)
await db_sess.commit()
await db_sess.flush()
endpoint_id = endpoint.id

return SuccessResponseModel()
return ServeInfoModel(
endpoint_id=endpoint_id,
name=params.service_name,
desired_session_count=params.desired_session_count,
active_routes=[],
service_endpoint=None,
is_public=params.open_to_public,
)


class TryStartResponseModel(BaseModel):
Expand Down

0 comments on commit 4a0fb50

Please sign in to comment.