Skip to content

Commit

Permalink
Ensure forward models after running ones are pending
Browse files Browse the repository at this point in the history
When realizations are resubmitted after failures, the snapshot shows
information from the previous run. This commit modifies the forward
model state of forward models following any Running state for a
realization to make sure they are set to Start/Pending.

The GUI will thus show correct colors for these forward models, but
error messages from the failed previous run are still available from the
GUI.
  • Loading branch information
berland committed Apr 25, 2024
1 parent 271e401 commit 4f9da11
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/ert/gui/model/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def prerender(

reals = snapshot.reals
forward_model_states = snapshot.get_forward_model_status_for_all_reals()

if not reals and not forward_model_states:
return None

Expand All @@ -128,13 +129,33 @@ def prerender(
isSnapshot = True
metadata[SORTED_REALIZATION_IDS] = sorted(snapshot.reals.keys(), key=int)
metadata[SORTED_JOB_IDS] = defaultdict(list)

running_forward_model_id: Dict[str, int] = {}
for (
real_id,
forward_model_id,
), forward_model_status in forward_model_states.items():
if forward_model_status == state.FORWARD_MODEL_STATE_RUNNING:
running_forward_model_id[real_id] = int(forward_model_id)

for (
real_id,
forward_model_id,
), forward_model_status in forward_model_states.items():
if isSnapshot:
metadata[SORTED_JOB_IDS][real_id].append(forward_model_id)
color = _QCOLORS[state.FORWARD_MODEL_STATE_TO_COLOR[forward_model_status]]
if (
real_id in running_forward_model_id
and int(forward_model_id) > running_forward_model_id[real_id]
):
# Triggered on resubmitted realizations
color = _QCOLORS[
state.FORWARD_MODEL_STATE_TO_COLOR[state.FORWARD_MODEL_STATE_START]
]
else:
color = _QCOLORS[
state.FORWARD_MODEL_STATE_TO_COLOR[forward_model_status]
]
metadata[REAL_JOB_STATUS_AGGREGATED][real_id][forward_model_id] = color

if isSnapshot:
Expand Down

0 comments on commit 4f9da11

Please sign in to comment.