diff --git a/src/_ert/forward_model_runner/forward_model_step.py b/src/_ert/forward_model_runner/forward_model_step.py index 8f84b944ee6..6808eea04c8 100644 --- a/src/_ert/forward_model_runner/forward_model_step.py +++ b/src/_ert/forward_model_runner/forward_model_step.py @@ -175,7 +175,7 @@ def _run(self) -> Generator[Start | Exited | Running | None]: target_file = self.job_data.get("target_file") target_file_mtime: Optional[int] = _get_target_file_ntime(target_file) - + run_start_time = dt.now() try: proc = Popen( arg_list, @@ -217,7 +217,9 @@ def _run(self) -> Generator[Start | Exited | Running | None]: exit_code = process.wait(timeout=self.MEMORY_POLL_PERIOD) except TimeoutExpired: potential_exited_msg = ( - self.handle_process_timeout_and_create_exited_msg(exit_code, proc) + self.handle_process_timeout_and_create_exited_msg( + exit_code, proc, run_start_time + ) ) if isinstance(potential_exited_msg, Exited): yield potential_exited_msg @@ -281,10 +283,9 @@ def _create_exited_msg_for_non_zero_exit_code( ) def handle_process_timeout_and_create_exited_msg( - self, exit_code: Optional[int], proc: Popen[Process] + self, exit_code: Optional[int], proc: Popen[Process], run_start_time: dt ) -> Exited | None: max_running_minutes = self.job_data.get("max_running_minutes") - run_start_time = dt.now() run_time = dt.now() - run_start_time if max_running_minutes is None or run_time.seconds > max_running_minutes * 60: