Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert changes to DataContainer storage format #1620

Merged
merged 8 commits into from
Aug 26, 2024
Merged

Revert changes to DataContainer storage format #1620

merged 8 commits into from
Aug 26, 2024

Conversation

pmrv
Copy link
Contributor

@pmrv pmrv commented Aug 23, 2024

PR #1364 changed saved the contents of the container in a data subgroup, but that breaks backwards compat and is not actually necessary for the TemplateJob, so revert it here.

pmrv added 2 commits August 23, 2024 15:05
PR #1364 changed saved the contents of the container in a data subgroup,
but that breaks backwards compat and is not actually necessary for the
TemplateJob, so revert it here.
@jan-janssen
Copy link
Member

It is only the new test that fails:

======================================================================
FAIL: test_dict_empty_list (generic.test_datacontainer.TestDataContainer.test_dict_empty_list) [to/from_dict should give back the same list as written.]
HasDict interface should work
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/pyiron_base/pyiron_base/tests/unit/generic/test_datacontainer.py", line 655, in test_dict_empty_list
    self.assertEqual(self.pl, l)
AssertionError: DataContainer({0: DataContainer({'foo': 'bar'}), 1: 2, 2: 4[110 chars]8])}) != DataContainer({0: {'foo': 'bar'}, 1: 2, 2: 42, 3: {'next': [35 chars] 8]})

----------------------------------------------------------------------

@jan-janssen
Copy link
Member

@pmrv While the tests in this pull request fail, this fixes the issue in the notebook tests of pyiron_atomistics.

@pmrv
Copy link
Contributor Author

pmrv commented Aug 24, 2024

I have a fix for the tests that I'll polish and push on Monday.

pmrv and others added 6 commits August 26, 2024 10:36
HasDict.to_dict uses join_children_dict to enable more efficient writing
to HDF.  When reading from HDF this does not matter, because h5io_browser
returns the dictionaries correctly, but when trying something like

>>> data = obj.to_dict()
>>> obj.from_dict(data)

objects can choke on the joined keys, so now from_dict splits the keys automatically
in case it finds any.
Also let the generic code from HasDict take care of the conversion of children.
@jan-janssen jan-janssen merged commit 959ad9d into main Aug 26, 2024
25 checks passed
@jan-janssen jan-janssen deleted the server branch August 26, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants