From 2a6f544517b78b9495d764640e754d22710d2ad3 Mon Sep 17 00:00:00 2001 From: "Yngve S. Kristiansen" Date: Fri, 1 Nov 2024 13:26:49 +0100 Subject: [PATCH] Edge case: Ignore response configs with empty .keys --- src/ert/storage/local_ensemble.py | 4 ++-- tests/ert/unit_tests/storage/test_local_storage.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ert/storage/local_ensemble.py b/src/ert/storage/local_ensemble.py index 325b90bb5d8..b432a127c7a 100644 --- a/src/ert/storage/local_ensemble.py +++ b/src/ert/storage/local_ensemble.py @@ -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]: diff --git a/tests/ert/unit_tests/storage/test_local_storage.py b/tests/ert/unit_tests/storage/test_local_storage.py index fdaff318241..c841342984f 100644 --- a/tests/ert/unit_tests/storage/test_local_storage.py +++ b/tests/ert/unit_tests/storage/test_local_storage.py @@ -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): @@ -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