Skip to content

Commit

Permalink
Reset started event
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Dec 14, 2023
1 parent 9fd4e8d commit b3737a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/ert/scheduler/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ async def _execute(self, sem: asyncio.BoundedSemaphore) -> None:
else:
await self._send(State.FAILED)
self.returncode = asyncio.Future()
self.started = asyncio.Event()

except asyncio.CancelledError:
await self._send(State.ABORTING)
Expand All @@ -109,8 +110,9 @@ async def __call__(

for _ in range(max_submit):
await self._execute(sem)
# job has succesfully finished, no need to retry
if self.returncode.done():
# job has succesfully finished or was aborted
# no need to retry
if self.returncode.done() or self.aborted.is_set():
break
else:
message = f"Realization: {self.iens} failed, resubmitting"
Expand Down
4 changes: 2 additions & 2 deletions src/ert/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ async def execute(

start = asyncio.Event()
sem = asyncio.BoundedSemaphore(
semaphore._initial_value if semaphore else 10
) # type: ignore
semaphore._initial_value if semaphore else 10 # type: ignore
)
for iens, job in self._jobs.items():
self._tasks[iens] = asyncio.create_task(
job(start, sem, self._max_submit)
Expand Down

0 comments on commit b3737a3

Please sign in to comment.