Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Jan 9, 2025
1 parent 9934398 commit c330a34
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ert/ensemble_evaluator/_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ async def _evaluate_inner( # pylint: disable=too-many-branches
def cancellable(self) -> bool:
return True

def cancel(self) -> None:
async def cancel(self) -> None:
if self._scheduler is not None:
self._scheduler.kill_all_jobs()
await self._scheduler.kill_all_jobs()
logger.debug("evaluator cancelled")


Expand Down
1 change: 0 additions & 1 deletion src/ert/ensemble_evaluator/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ async def process_message(self, msg: str) -> None:
async def signal_cancel(self) -> None:
await self._event_queue.put(Monitor._sentinel)
logger.debug(f"monitor-{self._id} asking server to cancel...")

cancel_event = EEUserCancel(monitor=self._id)
await self.send(event_to_json(cancel_event))
logger.debug(f"monitor-{self._id} asked server to cancel")
Expand Down
2 changes: 0 additions & 2 deletions src/ert/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ def __init__(
self.checksum: dict[str, dict[str, Any]] = {}

async def kill_all_jobs(self) -> None:
# Checking that the loop is running is required because everest is closing the
# simulation context whenever an optimization simulation batch is done
await self.cancel_all_jobs()

async def cancel_all_jobs(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ async def test_run_and_cancel_legacy_ensemble(
# and the ensemble is set to STOPPED
monitor._receiver_timeout = 10.0
cancel = True
await evaluator._ensemble._scheduler._running.wait()
async for event in monitor.track(heartbeat_interval=0.1):
# Cancel the ensemble upon the arrival of the first event
if cancel:
Expand Down

0 comments on commit c330a34

Please sign in to comment.