Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/engine/ov_genai/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,15 @@ async def _run_generation():
generation_kwargs,
streamer
)
def _generation_exception_handler(task: asyncio.Task):
exc = task.exception()
if exc and not task.cancelled():
# Force break the below loop
streamer.text_queue.put_nowait(None)
raise exc

gen_task = asyncio.create_task(_run_generation())
gen_task.add_done_callback(_generation_exception_handler)

try:
while True:
Expand Down
7 changes: 7 additions & 0 deletions src/engine/ov_genai/vlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,15 @@ async def _run_generation():
generation_config=generation_kwargs,
streamer=streamer,
)
def _generation_exception_handler(task: asyncio.Task):
exc = task.exception()
if exc and not task.cancelled():
# Force break the below loop
streamer.text_queue.put_nowait(None)
raise exc

gen_task = asyncio.create_task(_run_generation())
gen_task.add_done_callback(_generation_exception_handler)

try:
while True:
Expand Down