diff --git a/src/ert/scheduler/job.py b/src/ert/scheduler/job.py index 6e73cbcfe53..2959d58ccb1 100644 --- a/src/ert/scheduler/job.py +++ b/src/ert/scheduler/job.py @@ -94,7 +94,6 @@ async def _submit_and_run_once(self, sem: asyncio.BoundedSemaphore) -> None: try: await self._scheduler.submit_sleep_state.sleep_until_we_can_submit() await self._send(State.SUBMITTING) - await self.driver.submit( self.real.iens, self.real.job_script, cwd=self.real.run_arg.runpath ) @@ -148,6 +147,7 @@ async def __call__( ) -> None: self._requested_max_submit = max_submit await start.wait() + for attempt in range(max_submit): await self._submit_and_run_once(sem) diff --git a/src/ert/scheduler/scheduler.py b/src/ert/scheduler/scheduler.py index 64c0a6f51aa..3e1626a8c45 100644 --- a/src/ert/scheduler/scheduler.py +++ b/src/ert/scheduler/scheduler.py @@ -179,19 +179,14 @@ async def execute( ) cancel_when_execute_is_done(self._update_avg_job_runtime()) - start_events: MutableMapping[int, asyncio.Event] = {} + start = asyncio.Event() sem = asyncio.BoundedSemaphore(self._max_running or len(self._jobs)) for iens, job in self._jobs.items(): - start_events[iens] = asyncio.Event() self._tasks[iens] = asyncio.create_task( - job(start_events[iens], sem, self._max_submit) + job(start, sem, self._max_submit) ) - async def _set_start_event(iens: int, sleep_time: float) -> None: - start_events[iens].set() - - for _, iens in enumerate(self._jobs.keys()): - asyncio.create_task(_set_start_event(iens, 0)) + start.set() for task in self._tasks.values(): await task