diff --git a/src/ert/simulator/batch_simulator_context.py b/src/ert/simulator/batch_simulator_context.py index daa79b83997..a2f5be02bdc 100644 --- a/src/ert/simulator/batch_simulator_context.py +++ b/src/ert/simulator/batch_simulator_context.py @@ -7,6 +7,8 @@ import numpy as np +from ert.realization_state import RealizationState + from .simulation_context import SimulationContext if TYPE_CHECKING: @@ -53,11 +55,11 @@ def status(self) -> Status: Will return the state of the simulations. """ return Status( - running=self.getNumRunning(), - waiting=self.getNumWaiting(), - pending=self.getNumPending(), - complete=self.getNumSuccess(), - failed=self.getNumFailed(), + running=self._job_queue.count_status(RealizationState.RUNNING), + waiting=self._job_queue.count_status(RealizationState.WAITING), + pending=self._job_queue.count_status(RealizationState.PENDING), + complete=self._job_queue.count_status(RealizationState.SUCCESS), + failed=self._job_queue.count_status(RealizationState.FAILED), ) def results(self) -> List[Optional[Dict[str, "npt.NDArray[np.float64]"]]]: @@ -107,3 +109,4 @@ def results(self) -> List[Optional[Dict[str, "npt.NDArray[np.float64]"]]]: res.append(d) return res + return res diff --git a/src/ert/simulator/simulation_context.py b/src/ert/simulator/simulation_context.py index 08ad67c0d12..91710d13d55 100644 --- a/src/ert/simulator/simulation_context.py +++ b/src/ert/simulator/simulation_context.py @@ -152,21 +152,6 @@ def isRunning(self) -> bool: # TODO: Should separate between running jobs and having loaded all data return self._sim_thread.is_alive() or self._job_queue.is_active() - def getNumPending(self) -> int: - return self._job_queue.count_status(RealizationState.PENDING) # type: ignore - - def getNumRunning(self) -> int: - return self._job_queue.count_status(RealizationState.RUNNING) # type: ignore - - def getNumSuccess(self) -> int: - return self._job_queue.count_status(RealizationState.SUCCESS) # type: ignore - - def getNumFailed(self) -> int: - return self._job_queue.count_status(RealizationState.FAILED) # type: ignore - - def getNumWaiting(self) -> int: - return self._job_queue.count_status(RealizationState.WAITING) # type: ignore - def didRealizationSucceed(self, iens: int) -> bool: queue_index = self.get_run_args(iens).queue_index if queue_index is None: @@ -193,10 +178,10 @@ def isRealizationFinished(self, iens: int) -> bool: def __repr__(self) -> str: running = "running" if self.isRunning() else "not running" - numRunn = self.getNumRunning() - numSucc = self.getNumSuccess() - numFail = self.getNumFailed() - numWait = self.getNumWaiting() + numRunn = self._job_queue.count_status(RealizationState.RUNNING) + numSucc = self._job_queue.count_status(RealizationState.SUCCESS) + numFail = self._job_queue.count_status(RealizationState.FAILED) + numWait = self._job_queue.count_status(RealizationState.WAITING) return ( f"SimulationContext({running}, #running = {numRunn}, " f"#success = {numSucc}, #failed = {numFail}, #waiting = {numWait})"