Skip to content

Commit ce32ceb

Browse files
committed
Hopefully a cleaner pipeline
1 parent b4c5913 commit ce32ceb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

olmocr/pipeline.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,10 @@ async def timeout_task():
669669
except asyncio.CancelledError:
670670
logger.info("Got cancellation request for VLLM server")
671671
proc.terminate()
672+
try:
673+
await asyncio.wait_for(proc.wait(), timeout=10.0)
674+
except asyncio.TimeoutError:
675+
logger.warning("VLLM server did not terminate within 10 seconds")
672676
raise
673677

674678
timeout_task.cancel()
@@ -1209,6 +1213,9 @@ async def main():
12091213
vllm_server.cancel()
12101214
metrics_task.cancel()
12111215

1216+
# Wait for cancelled tasks to complete
1217+
await asyncio.gather(vllm_server, metrics_task, return_exceptions=True)
1218+
12121219
# Output final metrics summary
12131220
metrics_summary = metrics.get_metrics_summary()
12141221
logger.info("=" * 80)
@@ -1233,7 +1240,8 @@ async def main():
12331240
)
12341241

12351242
# Output finished_on_attempt statistics
1236-
logger.info("\nPages finished by attempt number:")
1243+
logger.info("")
1244+
logger.info("Pages finished by attempt number:")
12371245
total_finished = sum(total_metrics.get(f"finished_on_attempt_{i}", 0) for i in range(args.max_page_retries))
12381246
cumulative = 0
12391247

0 commit comments

Comments
 (0)