Skip to content

Commit

Permalink
Check combined ds in _has_response
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Oct 23, 2024
1 parent 6183e88 commit be21e08
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/ert/storage/local_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,28 @@ def _responses_exist_for_realization(
return True
path = self._realization_dir(realization)

def _has_response(_key: str) -> bool:
if _key in self.experiment.response_key_to_response_type:
_response_type = self.experiment.response_key_to_response_type[_key]
return (path / f"{_response_type}.parquet").exists()

return (path / f"{_key}.parquet").exists()
# Note: potential performance bottleneck,
# should be improved greatly by having statemap.
# Should also be faster due to lru cache on load_responses
def _has_response(_response_type: str) -> bool:

Check failure on line 307 in src/ert/storage/local_ensemble.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Missing return statement
if (path / f"{_response_type}.parquet").exists():
return True

if (self.mount_point / f"{_response_type}.parquet").exists():
return (
realization
in self.load_responses(
_response_type, tuple(range(self.ensemble_size))
)["realization"]
)

if key:
return _has_response(key)
response_type = self.experiment.response_key_to_response_type.get(key, key)
return _has_response(response_type)

return all(
_has_response(response)
for response in self.experiment.response_configuration
_has_response(response_type)
for response_type in self.experiment.response_configuration
)

def is_initalized(self) -> List[int]:
Expand Down

0 comments on commit be21e08

Please sign in to comment.