Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk committed Dec 30, 2024
1 parent 0554ab8 commit daca2e9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions keep/workflowmanager/workflowscheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,7 @@ async def _handle_event_workflows(self):
)


async def _start(self):
self.logger.info("Starting workflows scheduler")
async def _start_async(self):
while not self._stop:
# get all workflows that should run now
self.logger.debug(
Expand All @@ -637,6 +636,17 @@ async def _start(self):
await asyncio.sleep(1)
self.logger.info("Workflows scheduler stopped")

def _start(self):
"""
Generating new event loop and running the scheduler.
This method should be executed in a separate thread.
"""
self.logger.info("Starting workflows scheduler")
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
result = loop.run_until_complete(self._start_async())
loop.close()
return result

def stop(self):
self.logger.info("Stopping scheduled workflows")
Expand Down

0 comments on commit daca2e9

Please sign in to comment.