materialsproject / emmet

Be a master builder of databases of material properties. Avoid the Kragle.
https://materialsproject.github.io/emmet/
Other
52 stars 64 forks source link

Fix custodian json import issue #883

Closed JaGeo closed 9 months ago

JaGeo commented 9 months ago

Closes https://github.com/materialsproject/atomate2/issues/604. I would be happy if this could get merged soon.

codecov-commenter commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (8bf7303) 78.91% compared to head (b80cbea) 78.91%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #883 +/- ## ======================================= Coverage 78.91% 78.91% ======================================= Files 75 75 Lines 4217 4217 ======================================= Hits 3328 3328 Misses 889 889 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

JaGeo commented 9 months ago

@munrojm, would it be possible for you to have a look at this?

utf commented 9 months ago

Hi @JaGeo, thanks for this report.

A couple of thoughts:

JaGeo commented 9 months ago
  • Is this issue happening because the json parsing is using monty loadfn which is deserialising the objects? One fix would be to just use json.load. This will probably be quicker and less error prone.

@utf, I assume so. I think, however, that it does not happen during the initial reading but rather at a later point as the initial reading suppresses the usage of cls. https://github.com/materialsproject/emmet/blob/be40a1f58c8911148df2d33874f0412855b0a7ee/emmet-core/emmet/core/tasks.py#L785 From the error message, it fails at the start of relax2 rather than the end of relax1.

Just to add: both, Optional[Any] and Optional[Union[dict,VaspJob]] worked for me.

munrojm commented 9 months ago

@JaGeo sorry for the delay. This looks fine to me. I would prefer to be a bit more explicit with Optional[Union[dict,VaspJob]] as you have it.

JaGeo commented 9 months ago

@munrojm Thank you so much!