Skip to content

Commit

Permalink
Check scheduler loop is still running before killing all the jobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSava committed Jan 29, 2024
1 parent a90b11a commit 0c4a70c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ert/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def __init__(

def kill_all_jobs(self) -> None:
assert self._loop
asyncio.run_coroutine_threadsafe(self.cancel_all_jobs(), self._loop)
# Checking that the loop is running is required because everest is closing the
# simulation context whenever an optimization simulation batch is done
if self._loop.is_running():
asyncio.run_coroutine_threadsafe(self.cancel_all_jobs(), self._loop)

async def cancel_all_jobs(self) -> None:
self._cancelled = True
Expand Down

0 comments on commit 0c4a70c

Please sign in to comment.