Skip to content

Commit

Permalink
do not block ic by same req_id
Browse files Browse the repository at this point in the history
  • Loading branch information
rainyfly committed Dec 18, 2023
1 parent eb08074 commit 129537c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions llm_ic/fastdeploy_ic/server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ async def ModelStreamInfer(self, request, context):
# but we can not prevent two requests with the same req_id coming simultaneously.
# To achieve this, we should add lock to query and insert query into redis, which will influence performance.
# Currently, we assume different req_ids are confirmed by users.
if await data_manager.check_req_id_exist(model_id, req_id):
logger.info("ModelStreamInfer: req_id {}: has existed in other task".format(req_id))
await context.abort(grpc.StatusCode.INVALID_ARGUMENT, "ModelStreamInfer: req_id {}: has existed in other task".format(req_id))
# if await data_manager.check_req_id_exist(model_id, req_id):
# logger.info("ModelStreamInfer: req_id {}: has existed in other task".format(req_id))
# await context.abort(grpc.StatusCode.INVALID_ARGUMENT, "ModelStreamInfer: req_id {}: has existed in other task".format(req_id))
# 1. push request to redis
await data_manager.add_req_id_to_map(model_id, req_id)
await data_manager.enque_request(model_id, request)
logger.info("ModelStreamInfer: req_id {}: enqued request".format(req_id))
# 2. response stream results
response_start_time = time.time()
while True:
Expand Down
3 changes: 2 additions & 1 deletion llm_ic/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
aioredis
colorlog
grpcio
grpcio
protobuf
4 changes: 2 additions & 2 deletions llm_ic/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import setuptools

setuptools.setup(
name="fastdeploy-ic",
name="fastdeploy_ic",
version="0.0.9",
author="fastdeploy",
author_email="[email protected]",
Expand All @@ -28,6 +28,6 @@
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
install_requires=["colorlog"],
install_requires=["colorlog", "aioredis", "grpcio", "protobuf"],
extras_require={"client": ['grpcio', 'tritonclient']},
license='Apache 2.0')

0 comments on commit 129537c

Please sign in to comment.