Skip to content

Commit

Permalink
Remove current_iteration that shadows iteration
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Karlsen <[email protected]>
  • Loading branch information
andreas-el and jonathan-eq committed Dec 13, 2024
1 parent 1875f3b commit dc9defd
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion src/ert/cli/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _print_result(self, failed: bool, failed_message: str | None) -> None:
)

def _print_progress(self, event: SnapshotUpdateEvent) -> None:
current_iteration = min(event.total_iterations, event.current_iteration + 1)
current_iteration = min(event.total_iterations, event.iteration + 1)
if self._start_time is not None:
elapsed = datetime.now() - self._start_time
else:
Expand Down
1 change: 0 additions & 1 deletion src/ert/ensemble_evaluator/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
@dataclass
class _UpdateEvent:
iteration_label: str
current_iteration: int
total_iterations: int
progress: float
realization_count: int
Expand Down
2 changes: 0 additions & 2 deletions src/ert/run_models/base_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ def send_snapshot_event(self, event: Event, iteration: int) -> None:
self.send_event(
FullSnapshotEvent(
iteration_label=f"Running forecast for iteration: {iteration}",
current_iteration=iteration,
total_iterations=self._total_iterations,
progress=current_progress,
realization_count=realization_count,
Expand All @@ -487,7 +486,6 @@ def send_snapshot_event(self, event: Event, iteration: int) -> None:
self.send_event(
SnapshotUpdateEvent(
iteration_label=f"Running forecast for iteration: {iteration}",
current_iteration=iteration,
total_iterations=self._total_iterations,
progress=current_progress,
realization_count=realization_count,
Expand Down
1 change: 0 additions & 1 deletion tests/ert/unit_tests/cli/test_cli_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def test_print_progress():
monitor._start_time = datetime.now()
general_event = SnapshotUpdateEvent(
iteration_label="Test Phase",
current_iteration=0,
total_iterations=2,
progress=0.5,
realization_count=100,
Expand Down
16 changes: 0 additions & 16 deletions tests/ert/unit_tests/gui/simulation/test_run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def test_large_snapshot(
FullSnapshotEvent(
snapshot=large_snapshot,
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.5,
realization_count=4,
Expand All @@ -129,7 +128,6 @@ def test_large_snapshot(
FullSnapshotEvent(
snapshot=large_snapshot,
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.5,
realization_count=4,
Expand Down Expand Up @@ -172,7 +170,6 @@ def test_large_snapshot(
.build(["0"], state.REALIZATION_STATE_UNKNOWN)
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.25,
realization_count=4,
Expand All @@ -184,7 +181,6 @@ def test_large_snapshot(
[], status=state.REALIZATION_STATE_FINISHED
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.5,
realization_count=4,
Expand Down Expand Up @@ -212,7 +208,6 @@ def test_large_snapshot(
.build(["0"], state.REALIZATION_STATE_UNKNOWN)
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.25,
realization_count=4,
Expand All @@ -224,7 +219,6 @@ def test_large_snapshot(
["0"], status=state.REALIZATION_STATE_FINISHED
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.5,
realization_count=4,
Expand Down Expand Up @@ -256,7 +250,6 @@ def test_large_snapshot(
.build(["0", "1"], state.REALIZATION_STATE_UNKNOWN)
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.25,
realization_count=4,
Expand All @@ -273,7 +266,6 @@ def test_large_snapshot(
)
.build(["1"], status=state.REALIZATION_STATE_RUNNING),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.5,
realization_count=4,
Expand All @@ -290,7 +282,6 @@ def test_large_snapshot(
)
.build(["0"], status=state.REALIZATION_STATE_FAILED),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.5,
realization_count=4,
Expand All @@ -316,7 +307,6 @@ def test_large_snapshot(
.build(["0"], state.REALIZATION_STATE_UNKNOWN)
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.25,
realization_count=4,
Expand All @@ -335,7 +325,6 @@ def test_large_snapshot(
.build(["0"], state.REALIZATION_STATE_UNKNOWN)
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.5,
realization_count=4,
Expand Down Expand Up @@ -377,7 +366,6 @@ def test_run_dialog(events, tab_widget_count, qtbot: QtBot, run_dialog, event_qu
.build(["0"], state.REALIZATION_STATE_UNKNOWN)
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.25,
realization_count=4,
Expand All @@ -396,7 +384,6 @@ def test_run_dialog(events, tab_widget_count, qtbot: QtBot, run_dialog, event_qu
)
.build(["0"], status=state.REALIZATION_STATE_RUNNING),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.5,
realization_count=4,
Expand All @@ -415,7 +402,6 @@ def test_run_dialog(events, tab_widget_count, qtbot: QtBot, run_dialog, event_qu
)
.build(["0"], status=state.REALIZATION_STATE_FINISHED),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=1,
realization_count=4,
Expand Down Expand Up @@ -486,7 +472,6 @@ def test_run_dialog_memory_usage_showing(
)
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.25,
realization_count=4,
Expand Down Expand Up @@ -519,7 +504,6 @@ def test_run_dialog_memory_usage_showing(
.build(["0", "1"], status=state.REALIZATION_STATE_UNKNOWN)
),
iteration_label="Foo",
current_iteration=0,
total_iterations=1,
progress=0.25,
realization_count=4,
Expand Down

0 comments on commit dc9defd

Please sign in to comment.