From 3c4947f4029b1834826feb9f40e098edafabf5d5 Mon Sep 17 00:00:00 2001 From: xjules Date: Fri, 13 Sep 2024 13:28:23 +0200 Subject: [PATCH] Update restart experiment by updating shapshot only when restarting experiment --- src/ert/gui/simulation/run_dialog.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ert/gui/simulation/run_dialog.py b/src/ert/gui/simulation/run_dialog.py index 825da56045c..62f4ea48488 100644 --- a/src/ert/gui/simulation/run_dialog.py +++ b/src/ert/gui/simulation/run_dialog.py @@ -307,6 +307,8 @@ def __init__( self.on_run_model_event.connect(self._on_event) + self._restart = False + def _current_tab_changed(self, index: int) -> None: widget = self._tab_widget.widget(index) self.fm_step_frame.setHidden(isinstance(widget, UpdateWidget)) @@ -348,8 +350,10 @@ def closeEvent(self, a0: Optional[QCloseEvent]) -> None: a0.ignore() def run_experiment(self, restart: bool = False) -> None: - self._snapshot_model.reset() - self._tab_widget.clear() + self._restart = restart + if restart is False: + self._snapshot_model.reset() + self._tab_widget.clear() port_range = None if self._run_model.queue_system == QueueSystem.LOCAL: @@ -431,7 +435,14 @@ def _on_event(self, event: object) -> None: self.done_button.setHidden(False) elif isinstance(event, FullSnapshotEvent): if event.snapshot is not None: - self._snapshot_model._add_snapshot(event.snapshot, str(event.iteration)) + if self._restart: + self._snapshot_model._update_snapshot( + event.snapshot, str(event.iteration) + ) + else: + self._snapshot_model._add_snapshot( + event.snapshot, str(event.iteration) + ) self.update_total_progress(event.progress, event.iteration_label) self._progress_widget.update_progress( event.status_count, event.realization_count