Skip to content

Commit cce6223

Browse files
authored
fix bug with queue.empty not being reliable (deepspeedai#898)
See docs on `queue` for python multiprocessing. Specifically, `Because of multithreading/multiprocessing semantics, this is not reliable.`: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Queue.empty
1 parent fdb8ee2 commit cce6223

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

benchmarks/inference/mii/src/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _run_parallel(
219219

220220
time.sleep(random.uniform(0, args.num_clients) * 0.01)
221221
try:
222-
while not query_queue.empty():
222+
while True:
223223
print(f"queue size: {query_queue.qsize()} ({pid})", flush=True)
224224
input_tokens, req_max_new_tokens = query_queue.get(timeout=1.0)
225225

0 commit comments

Comments
 (0)