Skip to content

Commit

Permalink
Fix ert dark storage performance tests (#7109)
Browse files Browse the repository at this point in the history
Fixed ert dark storage performance tests timing out by changing src/ert/dark_storage/common.py get_observations_for_obs_keys(). Moved observations dict outside of loop to only generate dict once instead of every loop iteration.
  • Loading branch information
jonathan-eq authored Feb 5, 2024
1 parent 660b39f commit acd8bfe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ert/dark_storage/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ def get_observations_for_obs_keys(
ensemble: EnsembleReader, observation_keys: List[str]
) -> List[Dict[str, Any]]:
observations = []
experiment_observations = ensemble.experiment.observations
for key in observation_keys:
dataset = ensemble.experiment.observations[key]
dataset = experiment_observations[key]
observation = {
"name": key,
"values": list(dataset["observations"].values.flatten()),
Expand All @@ -105,8 +106,9 @@ def get_observations_for_obs_keys(


def get_observation_name(ensemble: EnsembleReader, observation_keys: List[str]) -> str:
observations_dict = ensemble.experiment.observations
for key in observation_keys:
observation = ensemble.experiment.observations[key]
observation = observations_dict[key]
if observation.response == "summary":
return observation.name.values.flatten()[0]
return key
Expand Down

0 comments on commit acd8bfe

Please sign in to comment.