Skip to content

Commit

Permalink
Fix worker controller exit request deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Xierumeng committed Jan 30, 2024
1 parent ab2c310 commit 9d41f99
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions utilities/workers/worker_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,20 @@ def check_pause(self):
def request_exit(self):
"""
Requests worker processes to exit.
Does nothing if already requested.
"""
time.sleep(self.__QUEUE_DELAY)
self.__exit_queue.put(None)
if self.__exit_queue.empty():
self.__exit_queue.put(None)

def clear_exit(self):
"""
Clears the exit request condition.
Does nothing if already cleared.
"""
time.sleep(self.__QUEUE_DELAY)
if not self.__exit_queue.empty():
self.__exit_queue.get()
_ = self.__exit_queue.get()

def is_exit_requested(self) -> bool:
"""
Expand Down

0 comments on commit 9d41f99

Please sign in to comment.