Skip to content

Commit

Permalink
fix: πŸ› Check task completion 1 it/s
Browse files Browse the repository at this point in the history
Check task completion once every second at minimum to end event loop if tasks are complete, even if workers didn't return proper messaging.
  • Loading branch information
rhoadesScholar committed Mar 10, 2024
1 parent a4e0b98 commit 9d3c540
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions daisy/server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from time import time
from .block import BlockStatus
from .block_bookkeeper import BlockBookkeeper
from .context import Context
Expand Down Expand Up @@ -69,12 +70,15 @@ def run_blockwise(self, tasks, scheduler=None):
return True if self.all_done else False

def _event_loop(self):

last_time = time()
while not self.stop_event.is_set():

current_time = time()
self._handle_client_messages()
self._check_for_lost_blocks()
self.worker_pools.check_worker_health()
if current_time - last_time > 1:
self._check_all_tasks_completed()
last_time = current_time

def _get_client_message(self):

Expand Down

0 comments on commit 9d3c540

Please sign in to comment.