Skip to content

Commit

Permalink
Fix max_running counting
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Nov 20, 2023
1 parent 111f575 commit 55fac51
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ert/job_queue/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ def real_state(self, iens: int) -> RealizationState:
return self._realizations[iens].current_state

def count_real_state(self, state: RealizationState) -> int:
return len([real for real in self._realizations if real.current_state == state])
return sum(
real.current_state == state
for real in self._realizations
)

async def run_done_callback(self, state: RealizationState):
state.validate()
Expand Down Expand Up @@ -163,7 +166,7 @@ def max_running(self) -> int:
return max_running

def available_capacity(self) -> bool:
return self.count_running() < self.max_running()
return self.count_real_state(Realization.RUNNING) < self.max_running()

def is_reals_state(self, state: RealizationState) -> bool:
return all(real.current_state == state for real in self._realizations)
Expand Down

0 comments on commit 55fac51

Please sign in to comment.