Skip to content

Commit

Permalink
Edge case: Ignore response configs with empty .keys
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Nov 1, 2024
1 parent cce6c9a commit 2a6f544
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ert/storage/local_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ def _has_response(_key: str) -> bool:
return _has_response(key)

return all(
_has_response(response)
for response in self.experiment.response_configuration
_has_response(response) if len(config.keys) > 0 else True
for response, config in self.experiment.response_configuration.items()
)

def is_initalized(self) -> List[int]:
Expand Down
12 changes: 9 additions & 3 deletions tests/ert/unit_tests/storage/test_local_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,10 @@ def save_summary(self, model_ensemble: Ensemble, summary_data):
model_smry_config = next(
config for config in model_experiment.responses if config.name == "summary"
)
model_smry_config.keys = sorted(response_keys)
model_smry_config.has_finalized_keys = True

if not model_smry_config.has_finalized_keys:
model_smry_config.keys = sorted(response_keys)
model_smry_config.has_finalized_keys = True

@rule(model_ensemble=ensembles)
def get_responses(self, model_ensemble: Ensemble):
Expand Down Expand Up @@ -880,7 +882,11 @@ def create_ensemble_from_prior(self, prior: Ensemble):
iens = 0
if (
list(prior.response_values.keys())
== [r.name for r in model_experiment.responses]
== [
r.name
for r in model_experiment.responses
if (r.has_finalized_keys and len(r.keys) > 0)
]
and iens not in prior.failure_messages
and prior_ensemble.get_ensemble_state()[iens]
!= RealizationStorageState.PARENT_FAILURE
Expand Down

0 comments on commit 2a6f544

Please sign in to comment.