Skip to content

Commit

Permalink
Pretty print json
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Jan 17, 2025
1 parent cc7db8b commit 946862b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 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 @@ -147,7 +147,7 @@ def create(
)

storage._write_transaction(
path / "index.json", index.model_dump_json().encode("utf-8")
path / "index.json", index.model_dump_json(indent=2).encode("utf-8")
)

return cls(storage, path, Mode.WRITE)
Expand Down Expand Up @@ -341,7 +341,7 @@ def set_failure(
type=failure_type, message=message if message else "", time=datetime.now()
)
self._storage._write_transaction(
filename, error.model_dump_json().encode("utf-8")
filename, error.model_dump_json(indent=2).encode("utf-8")
)

def unset_failure(
Expand Down
4 changes: 3 additions & 1 deletion src/ert/storage/local_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def create(
if name is None:
name = datetime.today().strftime("%Y-%m-%d")

(path / "index.json").write_text(_Index(id=uuid, name=name).model_dump_json())
(path / "index.json").write_text(
_Index(id=uuid, name=name).model_dump_json(indent=2)
)

parameter_data = {}
for parameter in parameters or []:
Expand Down
2 changes: 1 addition & 1 deletion src/ert/storage/migration/to5.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def migrate(path: Path) -> None:
print(
_Index(
id=UUID(experiment.name), name="default_experiment_name"
).model_dump_json(),
).model_dump_json(indent=2),
file=f,
)

Expand Down

0 comments on commit 946862b

Please sign in to comment.