Skip to content

Commit

Permalink
Fix memory being reported without units in GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq authored and berland committed Apr 25, 2024
1 parent 7d03596 commit f1c1c47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ert/gui/model/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,10 @@ def _job_data(self, index: QModelIndex, node: Node, role: int):
if role == Qt.DisplayRole:
_, data_name = COLUMNS[NodeType.REAL][index.column()]
if data_name in [ids.CURRENT_MEMORY_USAGE, ids.MAX_MEMORY_USAGE]:
data = node.data.get(ids.DATA)
_bytes = data.get(data_name) if data else None
data = node.data
_bytes: Optional[str] = data.get(data_name) if data else None
if _bytes:
return byte_with_unit(_bytes)
return byte_with_unit(float(_bytes))

if data_name in [ids.STDOUT, ids.STDERR]:
return "OPEN" if node.data.get(data_name) else QVariant()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/gui/simulation/test_run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,15 +494,15 @@ def test_run_dialog_memory_usage_showing(
current_memory_value = widget._job_model.data(
current_memory_column_proxy_index, Qt.DisplayRole
)
assert current_memory_value == "50000"
assert current_memory_value == "50.00 kB"

max_memory_column_proxy_index = widget._job_model.index(
job_number, max_memory_column_index
)
max_memory_value = widget._job_model.data(
max_memory_column_proxy_index, Qt.DisplayRole
)
assert max_memory_value == "60000"
assert max_memory_value == "60.00 kB"


@pytest.mark.usefixtures("use_tmpdir", "set_site_config", "using_scheduler")
Expand Down

0 comments on commit f1c1c47

Please sign in to comment.