Skip to content

Commit

Permalink
Printyprintyprint
Browse files Browse the repository at this point in the history
  • Loading branch information
Yngve S. Kristiansen committed Jul 1, 2024
1 parent 134a8f6 commit c8ddb62
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/ert/storage/local_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def to_file(self, path: Path) -> None:
with open(path, "w+") as f:
print("Dumped new state to json")
# print(self._states)
traceback.print_stack(limit=10)
traceback.print_stack(limit=None)
json.dump(self._to_json(), f)

def add(self, realization: int, entries: Set[Tuple[str, str, bool]]) -> None:
Expand Down Expand Up @@ -283,12 +283,16 @@ def create_realization_dir(realization: int) -> Path:
print(self._path)

self._realization_states: Optional[RealizationState] = None
print("self._realization_states: Optional[RealizationState] = None")
self.try_read_state_map_from_file()

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

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Call to untyped function "try_read_state_map_from_file" in typed context
self._response_states_need_update = False
self._parameter_states_need_update = False

def try_read_state_map_from_file(self):

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

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Function is missing a return type annotation
print("try_read_state_map_from_file(self):")
print(f"self._realization_states: {self._realization_states}")
if self._realization_states is None:
print(f"Has file? {os.path.exists(self._path / 'state_map.json')}")
self._realization_states = (
RealizationState.from_file(self._path / "state_map.json")
if os.path.exists(self._path / "state_map.json")
Expand Down Expand Up @@ -541,6 +545,7 @@ def _ensure_realization_state_initialized(self) -> None:
def _refresh_responses_state_if_needed(self) -> None:
self._ensure_realization_state_initialized()
if self._response_states_need_update:
print(f"id={self._index.id}, _refresh_responses_state_if_needed")
self._response_states_need_update = False
self._refresh_all_responses_state_for_all_realizations()
assert self._realization_states is not None
Expand All @@ -551,6 +556,7 @@ def _refresh_parameters_state_if_needed(self) -> None:
self._ensure_realization_state_initialized()

if self._parameter_states_need_update:
print(f"id={self._index.id}, _refresh_parameters_state_if_needed")
self._parameter_states_need_update = False
self._refresh_all_parameters_state_for_all_realizations()
assert self._realization_states is not None
Expand Down
1 change: 1 addition & 0 deletions src/ert/storage/local_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def _load_ensembles(self) -> Dict[UUID, LocalEnsemble]:
ensemble = LocalEnsemble(self, ensemble_path, self.mode)
ensembles.append(ensemble)
except FileNotFoundError:
print(f"Failed to load ensemble from path {ensemble}")
logger.exception(
"Failed to load an ensemble from path: %s", ensemble_path
)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/test_storage_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,12 @@ def test_that_storage_always_has_state_map_after_migrations(

for i in range(ensemble.ensemble_size):
if i % 2 == 0:
_ds_gen1 = ds_gen1.copy()
_ds_gen1 = ds_gen1.copy(deep=True)
_ds_gen1.coords["realization"] = [i]

ensemble.save_response("GEN", _ds_gen1, i)

_ds_bpr1 = ds_bpr1.copy()
_ds_bpr1 = ds_bpr1.copy(deep=True)
_ds_bpr1.coords["realizations"] = [i]
ensemble.save_parameters("BPR", i, _ds_bpr1)

Expand Down

0 comments on commit c8ddb62

Please sign in to comment.