Skip to content

Commit

Permalink
Show ert version/komodo version in GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk authored Jun 10, 2024
1 parent 9b517d2 commit 48ab658
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
12 changes: 12 additions & 0 deletions src/ert/gui/find_ert_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os
import socket

from ert.shared import __version__


def find_ert_info() -> str:
is_on_cluster = "KOMODO_RELEASE" in os.environ
if is_on_cluster:
hostname = socket.gethostname()
return f"{os.environ['KOMODO_RELEASE']} @ {hostname}"
return f"version {__version__}"
3 changes: 2 additions & 1 deletion src/ert/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from ert.gui.about_dialog import AboutDialog
from ert.gui.ertnotifier import ErtNotifier
from ert.gui.find_ert_info import find_ert_info
from ert.shared.plugins import ErtPluginManager

if TYPE_CHECKING:
Expand All @@ -33,7 +34,7 @@ def __init__(
self.notifier = ErtNotifier(config_file)
self.tools: Dict[str, Tool] = {}

self.setWindowTitle(f"ERT - {config_file}")
self.setWindowTitle(f"ERT - {config_file} - {find_ert_info()}")

self.plugin_manager = plugin_manager
self.__main_widget: Optional[QWidget] = None
Expand Down
3 changes: 2 additions & 1 deletion src/ert/gui/simulation/run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
from ert.run_models.event import RunModelDataEvent, RunModelErrorEvent
from ert.shared.status.utils import byte_with_unit, format_running_time

from ..find_ert_info import find_ert_info
from ..model.node import NodeType
from .queue_emitter import QueueEmitter
from .view import LegendView, ProgressView, RealizationWidget, UpdateWidget
Expand All @@ -77,7 +78,7 @@ def __init__(
self.setAttribute(Qt.WA_DeleteOnClose)
self.setWindowFlags(Qt.Window)
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
self.setWindowTitle(f"Experiment - {config_file}")
self.setWindowTitle(f"Experiment - {config_file} {find_ert_info()}")

self._snapshot_model = SnapshotModel(self)
self._run_model = run_model
Expand Down
16 changes: 8 additions & 8 deletions tests/unit_tests/gui/test_main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_that_the_ui_show_no_errors_and_enables_update_for_poly_example(qapp):
for i in range(combo_box.count()):
assert combo_box.model().item(i).isEnabled()

assert gui.windowTitle() == "ERT - poly.ert"
assert gui.windowTitle().startswith("ERT - poly.ert")


@pytest.mark.usefixtures("set_site_config")
Expand All @@ -126,7 +126,7 @@ def test_gui_shows_a_warning_and_disables_update_when_there_are_no_observations(
for i in range(3, 5):
assert not combo_box.model().item(i).isEnabled()

assert gui.windowTitle() == "ERT - config.ert"
assert gui.windowTitle().startswith("ERT - config.ert")


@pytest.mark.usefixtures("copy_poly_case")
Expand All @@ -153,7 +153,7 @@ def test_gui_shows_a_warning_and_disables_update_when_parameters_are_missing(
for i in range(3, 5):
assert not combo_box.model().item(i).isEnabled()

assert gui.windowTitle() == "ERT - poly-no-gen-kw.ert"
assert gui.windowTitle().startswith("ERT - poly-no-gen-kw.ert")


@pytest.mark.usefixtures("use_tmpdir", "set_site_config", "using_scheduler")
Expand Down Expand Up @@ -249,7 +249,7 @@ def test_that_run_workflow_component_disabled_when_no_workflows(qapp):
args.config = "poly.ert"
with add_gui_log_handler() as log_handler:
gui, *_ = ert.gui.main._start_initial_gui_window(args, log_handler)
assert gui.windowTitle() == "ERT - poly.ert"
assert gui.windowTitle().startswith("ERT - poly.ert")
run_workflow_button = gui.tools["Run workflow"]
assert not run_workflow_button.isEnabled()

Expand All @@ -275,7 +275,7 @@ def test_that_run_workflow_component_enabled_when_workflows(qapp, tmp_path):

with add_gui_log_handler() as log_handler:
gui, *_ = ert.gui.main._start_initial_gui_window(args, log_handler)
assert gui.windowTitle() == "ERT - config.ert"
assert gui.windowTitle().startswith("ERT - config.ert")
run_workflow_button = gui.tools["Run workflow"]
assert run_workflow_button.isEnabled()

Expand All @@ -286,7 +286,7 @@ def test_that_es_mda_is_disabled_when_weights_are_invalid(qtbot):
args.config = "poly.ert"
with add_gui_log_handler() as log_handler:
gui, *_ = ert.gui.main._start_initial_gui_window(args, log_handler)
assert gui.windowTitle() == "ERT - poly.ert"
assert gui.windowTitle().startswith("ERT - poly.ert")

combo_box = get_child(gui, QComboBox, name="experiment_type")
combo_box.setCurrentIndex(4)
Expand Down Expand Up @@ -335,7 +335,7 @@ def test_that_ert_changes_to_config_directory(qtbot):
args.config = "test_data/snake_oil_surface.ert"
with add_gui_log_handler() as log_handler:
gui, *_ = ert.gui.main._start_initial_gui_window(args, log_handler)
assert gui.windowTitle() == "ERT - snake_oil_surface.ert"
assert gui.windowTitle().startswith("ERT - snake_oil_surface.ert")


@pytest.mark.usefixtures("using_scheduler")
Expand Down Expand Up @@ -689,7 +689,7 @@ def test_that_es_mda_restart_run_box_is_disabled_when_there_are_no_cases(qtbot):
project=os.path.abspath(ert_config.ens_path),
):
gui, *_ = ert.gui.main._start_initial_gui_window(args, GUILogHandler())
assert gui.windowTitle() == "ERT - poly.ert"
assert gui.windowTitle().startswith("ERT - poly.ert")

combo_box = get_child(gui, QComboBox, name="experiment_type")
assert combo_box.count() == 6
Expand Down

0 comments on commit 48ab658

Please sign in to comment.