Skip to content

Commit d392438

Browse files
committed
Cleanup queue to avoid leaving zombie ticket
1 parent 540cc8c commit d392438

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sdks/python/apache_beam/ml/inference/model_manager.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,12 @@ def acquire_model(self, tag: str, loader_func: Callable[[], Any]) -> Any:
380380
finally:
381381
if self._wait_queue and self._wait_queue[0][2] is my_id:
382382
heapq.heappop(self._wait_queue)
383-
self._cv.notify_all()
383+
else:
384+
for i, item in enumerate(self._wait_queue):
385+
if item[2] is my_id:
386+
self._wait_queue.pop(i)
387+
heapq.heapify(self._wait_queue)
388+
self._cv.notify_all()
384389

385390
if should_spawn:
386391
return self._spawn_new_model(tag, loader_func, is_unknown, est_cost)

0 commit comments

Comments
 (0)