Skip to content

Commit

Permalink
fix bugs in aborting
Browse files Browse the repository at this point in the history
  • Loading branch information
mchen644 committed Oct 17, 2024
1 parent 65d60a5 commit 3220ac3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
23 changes: 9 additions & 14 deletions benchmarks/benchmark_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,15 +496,6 @@ async def handle_requests():
request_func_input = await asyncio.get_event_loop().run_in_executor(None, request_queue.get)
if request_func_input is None:
break

# # if backend == "vllm":
# # result = asyncio.run(
# # request_func(args.scheduler_policy, request_func_input=request_func_input, pbar=pbar)
# # )
# # else:
# # result = asyncio.run(
# # request_func(request_func_input=request_func_input, pbar=pbar)
# # )

if backend == "vllm":
tasks.append(
Expand All @@ -524,11 +515,11 @@ async def handle_requests():

# Gather the results of all tasks
outputs = await asyncio.gather(*tasks)
# result_queue.put(outputs)
await asyncio.get_event_loop().run_in_executor(None, result_queue.put, outputs)


asyncio.run(handle_requests())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(handle_requests())
# asyncio.run(handle_requests())

async def generate_requests(input_requests, request_rate, request_duration, model_id, api_url, best_of, use_beam_search):
async for request in get_request_duration(input_requests, request_rate, request_duration):
Expand Down Expand Up @@ -647,21 +638,25 @@ async def benchmark(
use_beam_search=use_beam_search,
)
request_queue.put(request_func_input)
# await asyncio.get_event_loop().run_in_executor(None, request_queue.put, request_func_input)
# request_generator.join()

# tasks = []
total_outputs: List[RequestFuncOutput] = []

for _ in range(num_workers):
# await asyncio.get_event_loop().run_in_executor(None, request_queue.put, None)
request_queue.put(None)

outputs: List[RequestFuncOutput] = []
# with lock:

while True:
try:
# result = await asyncio.get_event_loop().run_in_executor(None, result_queue.get, timeout=2)
result = result_queue.get(timeout=2)
outputs.append(result)
for res in result:
outputs.append(res)
# break
except Exception as error:
break
Expand Down
10 changes: 5 additions & 5 deletions rebuild_vllm.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# rm -r build
pip uninstall -y vllm
taskset -c 14-19 python3 setup.py bdist_wheel --dist-dir=dist
pip install dist/vllm-0.4.3+cu124-cp310-cp310-linux_x86_64.whl
pip uninstall -y vllm-flash-attn
clear
#pip uninstall -y vllm
#taskset -c 14-19 python3 setup.py bdist_wheel --dist-dir=dist
#pip install dist/vllm-0.4.3+cu124-cp310-cp310-linux_x86_64.whl
#pip uninstall -y vllm-flash-attn
#clear
cd benchmarks
bash 1_serving_benchmark.sh

0 comments on commit 3220ac3

Please sign in to comment.