File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/bespokelabs/curator/request_processor Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -329,6 +329,7 @@ async def process_requests_from_file(
329
329
await asyncio .gather (* pending_requests )
330
330
331
331
# Process any remaining retries in the queue
332
+ pending_retries = []
332
333
while not queue_of_requests_to_retry .empty ():
333
334
retry_request = await queue_of_requests_to_retry .get ()
334
335
token_estimate = self .estimate_total_tokens (retry_request .generic_request .messages )
@@ -356,7 +357,12 @@ async def process_requests_from_file(
356
357
status_tracker = status_tracker ,
357
358
)
358
359
)
359
- await task
360
+ pending_retries .append (task )
361
+ await asyncio .sleep (0.1 ) # Allow other tasks to run
362
+
363
+ # Wait for all retry tasks to complete
364
+ if pending_retries :
365
+ await asyncio .gather (* pending_retries )
360
366
361
367
status_tracker .pbar .close ()
362
368
@@ -406,7 +412,7 @@ async def handle_single_request_with_retries(
406
412
407
413
except Exception as e :
408
414
logger .warning (
409
- f"Request { request .task_id } failed with Exception { e } , attempts left { request .attempts_left - 1 } "
415
+ f"Request { request .task_id } failed with Exception { e } , attempts left { request .attempts_left } "
410
416
)
411
417
status_tracker .num_other_errors += 1
412
418
request .result .append (e )
You can’t perform that action at this time.
0 commit comments