Skip to content

Commit

Permalink
Fix bugs uncovered in simulation context
Browse files Browse the repository at this point in the history
Poking an internal variable in queue, _queue_stopped. This should perhaps
be an official way in order to stop the queue from a sync context
  • Loading branch information
berland committed Nov 24, 2023
1 parent 9013827 commit e0c871b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/ert/job_queue/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ async def submit(self, realization: "RealizationState") -> None:
if process.returncode == 0:
if output:
logger.info(output)
realization.runend()
if str(realization.current_state.id) == "RUNNING":
realization.runend()
else:
logger.debug(
f"Realization {realization.realization.run_arg.iens} finished "
f"successfully but was in state {realization.current_state.id}"
)
else:
if output:
logger.error(output)
Expand Down
6 changes: 5 additions & 1 deletion src/ert/job_queue/realization_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ def on_enter_EXIT(self) -> None:
failed_job = exit_file.find("job").text
error_reason = exit_file.find("reason").text
stderr_capture = exit_file.find("stderr").text
stderr_file = exit_file.find("stderr_file").text

stderr_file = ""
if stderr_file_node := exit_file.find("stderr_file"):
stderr_file = stderr_file_node.text

logger.error(
f"job {failed_job} failed with: '{error_reason}'\n"
f"\tstderr file: '{stderr_file}',\n"
Expand Down
2 changes: 1 addition & 1 deletion src/ert/simulator/simulation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def get_sim_fs(self) -> EnsembleAccessor:
return self._run_context.sim_fs

def stop(self) -> None:
self.job_queue.kill_all_jobs()
self.job_queue._queue_stopped = True
self._sim_thread.join()

def job_progress(self, iens: int) -> Optional[ForwardModelStatus]:
Expand Down

0 comments on commit e0c871b

Please sign in to comment.