Skip to content

Commit

Permalink
remove dead code (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketmaurya authored Aug 30, 2024
1 parent 7e509bb commit 07d60df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
18 changes: 0 additions & 18 deletions src/litserve/loops.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import inspect
import logging
import multiprocessing as mp
import os
import pickle
import sys
import time
Expand Down Expand Up @@ -44,12 +43,6 @@

logger = logging.getLogger(__name__)

# if defined, it will require clients to auth with X-API-Key in the header
LIT_SERVER_API_KEY = os.environ.get("LIT_SERVER_API_KEY")

# timeout when we need to poll or wait indefinitely for a result in a loop.
LONG_TIMEOUT = 100

# FastAPI writes form files to disk over 1MB by default, which prevents serialization by multiprocessing
MultiPartParser.max_file_size = sys.maxsize

Expand All @@ -61,17 +54,6 @@ def _inject_context(context: Union[List[dict], dict], func, *args, **kwargs):
return func(*args, **kwargs)


def get_batch_from_uid(uids, lit_api, request_buffer):
batches = []
for uid in uids:
try:
x_enc, pipe_s = request_buffer.pop(uid)
except KeyError:
continue
batches.append((x_enc, pipe_s))
return batches


def collate_requests(
lit_api: LitAPI, request_queue: Queue, max_batch_size: int, batch_timeout: float
) -> Tuple[List, List]:
Expand Down
9 changes: 3 additions & 6 deletions src/litserve/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from typing import Callable, Dict, Optional, Sequence, Tuple, Union

import uvicorn
from fastapi import BackgroundTasks, Depends, FastAPI, HTTPException, Request, Response
from fastapi import Depends, FastAPI, HTTPException, Request, Response
from fastapi.responses import StreamingResponse
from fastapi.security import APIKeyHeader
from starlette.formparsers import MultiPartParser
Expand Down Expand Up @@ -58,9 +58,6 @@
# if defined, it will require clients to auth with X-API-Key in the header
LIT_SERVER_API_KEY = os.environ.get("LIT_SERVER_API_KEY")

# timeout when we need to poll or wait indefinitely for a result in a loop.
LONG_TIMEOUT = 100

# FastAPI writes form files to disk over 1MB by default, which prevents serialization by multiprocessing
MultiPartParser.max_file_size = sys.maxsize

Expand Down Expand Up @@ -306,7 +303,7 @@ async def health(request: Request) -> Response:

return Response(content="not ready", status_code=503)

async def predict(request: self.request_type, background_tasks: BackgroundTasks) -> self.response_type:
async def predict(request: self.request_type) -> self.response_type:
response_queue_id = self.app.response_queue_id
uid = uuid.uuid4()
event = asyncio.Event()
Expand All @@ -331,7 +328,7 @@ async def predict(request: self.request_type, background_tasks: BackgroundTasks)
load_and_raise(response)
return response

async def stream_predict(request: self.request_type, background_tasks: BackgroundTasks) -> self.response_type:
async def stream_predict(request: self.request_type) -> self.response_type:
response_queue_id = self.app.response_queue_id
uid = uuid.uuid4()
event = asyncio.Event()
Expand Down

0 comments on commit 07d60df

Please sign in to comment.