pyiron_base icon indicating copy to clipboard operation
pyiron_base copied to clipboard

Add two classes for HasHDF/HasDict compat

Open pmrv opened this issue 1 year ago • 8 comments

and outline transition path in docstrings there.

pmrv avatar Mar 02 '24 07:03 pmrv

@jan-janssen and I discussed something like this last week. The problem statement is essentially: We want everything as to_dict, but don't want to convert all to_hdf at once. Some code also still expects to be able to call to_hdf and again we don't want to change those all at one as well. So this introduces two mixins that can translate implementers of HasHDF and HasDict between each other. If we use them we can then slowly fade out to_hdf implementation by manually converting them to HasHDF over time. Once all objects are converted, we deprecate HasHDFfromDict.to_hdf to show us what we need to update in the surrounding code, and when that is done we remove both classes again.

Tests will need to follow and it's not yet used by any objects, but I want to discuss this plan and the design first.

pmrv avatar Mar 02 '24 08:03 pmrv

Error: The action 'Test' has timed out after 5 minutes.

pmrv avatar Mar 03 '24 14:03 pmrv

I've added a test in form of the DataContainer implementation of HasDictFromHDF and adapted DummyHDFio to work with this.

@jan-janssen I'd prefer to merge this in before proceeding with your to_dict series of PRs. Changes needed there to use this would hopefully be minimal.

I've noticed as well when running the tests locally that there is one location where we create a job with run_mode=="manual" that hangs for a long time before the tests proceed. This may be the issue of the timeout problems we are seeing with the CI, but I couldn't locate the test case yet. I have a feeling this may be related to the files changes with the decompression that we did recently. I have also seen a bunch unrelated test failures locally.

pmrv avatar Mar 19 '24 16:03 pmrv

@jan-janssen I'd prefer to merge this in before proceeding with your to_dict series of PRs. Changes needed there to use this would hopefully be minimal.

The only pull requests which use HasDict are https://github.com/pyiron/pyiron_base/pull/1380 and https://github.com/pyiron/pyiron_base/pull/1377 . As those are required for https://github.com/pyiron/pyiron_atomistics/pull/1356 I would prefer to merge those first before we change the interface.

jan-janssen avatar Mar 19 '24 18:03 jan-janssen

The reason for the unit tests hanging is this line

https://github.com/pyiron/pyiron_base/blob/0bdde9b73eb32f85688808898b208f716b606689/tests/job/test_worker.py#L26

pmrv avatar Mar 25 '24 16:03 pmrv

The reason for the unit tests hanging is this line

https://github.com/pyiron/pyiron_base/blob/0bdde9b73eb32f85688808898b208f716b606689/tests/job/test_worker.py#L26

What I don't understand is why this is suddenly a problem as this PR doesn't touch worker code at all.

pmrv avatar Mar 25 '24 16:03 pmrv

Seems this only breaks, once I touched GenericParameters.

pmrv avatar Mar 26 '24 12:03 pmrv

@jan-janssen I can't seem to fix this quickly today, so go ahead with the other PRs.

pmrv avatar Mar 26 '24 12:03 pmrv

@pmrv As https://github.com/pyiron/pyiron_base/pull/1578 and https://github.com/pyiron/pyiron_base/pull/1580 are now merged - can you update this pull request, so we can include it in the next release? I think the three pull requests together streamline the to_dict() and from_dict() interface, so I would like to release them as part of pyiron_base=0.10.0.

jan-janssen avatar Aug 15 '24 16:08 jan-janssen

contrib tests fail because its dependencies cannot currently be installed concurrently with the ones from atomistics.

pmrv avatar Aug 16 '24 10:08 pmrv

This is in a good state now, but I'm still trying to add recursive to_dict/from_dict (in a separate PR).

pmrv avatar Aug 16 '24 10:08 pmrv

@pmrv Can this be merged? Or should we wait for ta new h5io_browser version to include https://github.com/h5io/h5io_browser/pull/61 ?

jan-janssen avatar Aug 17 '24 10:08 jan-janssen

Both this and #1602 dont need the h5io fix, thats just something I found while trying to get the jobs read their dicts from HDF recursively.

pmrv avatar Aug 17 '24 11:08 pmrv