mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-05-20 05:17:01 +08:00
Small async_llm_engine refactor (#2618)
This commit is contained in:
parent
f8ecb84c02
commit
89be30fa7d
@ -53,7 +53,7 @@ class AsyncStream:
|
|||||||
self._queue.put_nowait(item)
|
self._queue.put_nowait(item)
|
||||||
|
|
||||||
def finish(self) -> None:
|
def finish(self) -> None:
|
||||||
self._queue.put_nowait(StopIteration)
|
self._queue.put_nowait(StopAsyncIteration())
|
||||||
self._finished = True
|
self._finished = True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -65,9 +65,7 @@ class AsyncStream:
|
|||||||
|
|
||||||
async def __anext__(self) -> RequestOutput:
|
async def __anext__(self) -> RequestOutput:
|
||||||
result = await self._queue.get()
|
result = await self._queue.get()
|
||||||
if result is StopIteration:
|
if isinstance(result, Exception):
|
||||||
raise StopAsyncIteration
|
|
||||||
elif isinstance(result, Exception):
|
|
||||||
raise result
|
raise result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user